我正在尝试使用此函数发送字符串。
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()
}
当我到达这条线时:
$requestStream = $webrequest.GetRequestStream()
脚本似乎进入无限循环。
有人能看到问题吗?
吉斯利
答案 0 :(得分:1)
我建议使用WireShark查看线路上发生的情况,并检查服务器日志。