I’m trying to use this function to send a string.
function submit_report_http
{
param($report)
trap{return 1}
if($verbose -gt 1){minfo 'Sending report via http, url is ' + $http_url}
$webRequest = [System.Net.WebRequest]::Create($http_url)
$webRequest.ContentType = "text/html"
$PostStr = [System.Text.Encoding]::UTF8.GetBytes($report)
$webrequest.ContentLength = $PostStr.Length
$webRequest.ServicePoint.Expect100Continue = $false
if($verbose -gt 1){minfo ' authenticating user: ' + $http_user}
$webRequest.Credentials = New-Object System.Net.NetworkCredential -ArgumentList $http_user, $http_pass
$webRequest.PreAuthenticate = $true
$webRequest.Method = "PUT"
$requestStream = $webRequest.GetRequestStream()
$requestStream.Write($PostStr, 0,$PostStr.length)
$requestStream.Flush()
$requestStream.Close()
}
When I get to the line:
$requestStream = $webrequest.GetRequestStream()
The script seems to go in to an infinite loop.
Can anyone see the problem?
Gísli
I recommend using WireShark to see what’s happening on the wire and also checking your server logs.