Post data to a form via Proxy

tonelm54
tonelm54 used Ask the Experts™
on
I want to be able to submit a webform with some values, however my simple code just says:-

Invoke-WebRequest : This operation is not supported for a relative URI.
At D:\Desktop\Post Data - Invoke.ps1:2 char:9
+ $test = Invoke-WebRequest -Uri http://http://localhost/TestForm.php -Method POST ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-WebRequest], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand




My code is quite simple, and dont see why it should not work:-
$postParams = @{username='me';moredata='qwerty'}
$test = Invoke-WebRequest -Uri http://http://localhost/TestForm.php -Method POST -Body $postParams -Proxy '192.168.1.120:3128'

Open in new window


Any ideas?

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fixer of Problems
Most Valuable Expert 2014
Commented:
You've 'http://' in there twice.  http://http:// makes it an invalid URL.

Author

Commented:
DOH!!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial