主要是伪装http头的问题,郁闷的,我用xmlhttp.setRequestHeader伪装没调试成功function HttpPostConnect($host,$path,$fieldArray=array())
{
$port=80;
if(sizeof($fieldArray) > 0) {
$body = _encodeFields( $fieldArray );
}else{
$body = "";
}
$len = strlen( $body ); $request=($body ? "POST" : "GET")." $path HTTP/1.0\r\n".
"Host: $host\r\n".
"Accept: */*\r\n".
"Accept-Language: en-us,zh-cn;q=0.5\r\n".
($body ? "Content-type: application/x-www-form-urlencoded\r\n" : "").
"Proxy-Connection: Keep-Alive\r\n".
($len ? "content-length: $len\r\n" : "").
"\r\n".
($body ? "$body" : "");
$fp = fsockopen( "$host", $port, $errno, $errdesc, 30 );
if(!$fp) return false;
fputs($fp,$request);
while(trim(fgets($fp,1024)) != "");
return $fp;
}
{
$port=80;
if(sizeof($fieldArray) > 0) {
$body = _encodeFields( $fieldArray );
}else{
$body = "";
}
$len = strlen( $body ); $request=($body ? "POST" : "GET")." $path HTTP/1.0\r\n".
"Host: $host\r\n".
"Accept: */*\r\n".
"Accept-Language: en-us,zh-cn;q=0.5\r\n".
($body ? "Content-type: application/x-www-form-urlencoded\r\n" : "").
"Proxy-Connection: Keep-Alive\r\n".
($len ? "content-length: $len\r\n" : "").
"\r\n".
($body ? "$body" : "");
$fp = fsockopen( "$host", $port, $errno, $errdesc, 30 );
if(!$fp) return false;
fputs($fp,$request);
while(trim(fgets($fp,1024)) != "");
return $fp;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货