Retrieve file from web

  • 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

  • If there's anything else I can provide to help you help me, let me know!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply