Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Retrieve file from web Expand / Collapse
Author
Message
Posted Friday, September 6, 2013 2:36 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 4:02 PM
Points: 492, Visits: 2,040
Hello,

I've exhausted myself trying to get this to work with cURL, and am trying to get it to work with PS v3 now. I've stitched together code from a couple places and come up with this:

$formFields = @{sendusername='user';password='pass'}
invoke-webrequest “http://www.ims-dm.com/cgi/download2.php?productid=WIREFTPM”| -Method Post -Body $formFields select -exp links|where{$_.href -like "*.zip"}|select -exp href|foreach{start-bitstransfer $_ C:\SurveyComputing}

Which results in this:
-Method : The term '-Method' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:81
+ ... tid=WIREFTPM”| -Method Post -Body $formFields select -exp links|where{$_.href -l ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Method:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException


The cURL issue I was running into was something with the URI of the website being obscured by a .php or Java redirect. Not sure if I'll have the same issue with PS, but I'd like to give something else a try.

Any suggestions or pointers are appreciated.

Thanks
Post #1492424
Posted Friday, September 6, 2013 3:40 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 4:02 PM
Points: 492, Visits: 2,040
If there's anything else I can provide to help you help me, let me know!

Post #1492442
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse