Sam Jacobs
asked on
Trying to Pass Custom Headers to WebsIte Via PowerShell
I am trying to navigate to a website via PowerShell and pass custom header information with the following:
Any assistance is greatly appreciated.
$ie = new-object -comobject 'internetexplorer.Application'
$ie.Visible = $True
$headers = @{"x-custom-1"="custom Value 1"}
$headers += @{"x-custom-2"="custom Value 2"}
$ie.Navigate("http://www.xhaus.com/headers",$Null,"_self",$Null,$headers)
However, the headers don't seem to be making it to the site.Any assistance is greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
As always, thanks for your help - for me as well as the entire PowerShell community!
ASKER
Thank you very much!
I had Googled quite a bit and found that Invoke-WebRequest took a hashtable as input to its Header parameter.
I (erroneously) thought it would be the same for the COM object.
Doesn't the code above stick a CRLF at the end of all headers instead of after each one?
Thanks!
Sam