Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Retrieve file from web

$
0
0
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:[code="other"]$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}[/code]Which results in this:[code="plain"]-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[/code]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

Viewing all articles
Browse latest Browse all 467

Trending Articles