日期:2014-05-17  浏览次数:20963 次

asp中有什么方法可以代替php的fsockopen函数
主要是伪装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;
}

------解决方案--------------------
asp没有socket函数, xmlhttp.setRequestHeader伪装不成功,说来听听有什么问题?
------解决方案--------------------
我觉得写个socket的动态库更好一些,在asp调用
------解决方案--------------------
哪位大哥能不能告诉我怎么开始学习ASP技术
------解决方案--------------------
自己定议一个function