Solved

Post data to a form via Proxy

Posted on 2014-02-26
2
381 Views
Last Modified: 2014-02-26
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
0
Comment
Question by:tonelm54
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39888184
You've 'http://' in there twice.  http://http:// makes it an invalid URL.
0
 

Author Comment

by:tonelm54
ID: 39888616
DOH!!!!
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
A procedure for exporting installed hotfix details of remote computers using powershell
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question