日期:2014-05-16  浏览次数:20401 次

fsockopen不能正确获取网页,返回403错误
php的fsockopen函数能正常获取其他网页,但获取http://check.ptlogin2.qq.com/check?regmaster=&uin=369872340&appid=549000912&js_ver=10049&js_type=1&login_sig=4aNczek7pQ2h04JL8nS0xfDqPQsJ-oF5czyfk1lOAY47-HswQg3rmElsCZ6QIAyO&u1=http%3A%2F%2Fqzs.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&r=0.42962526359176423
时却是403错误。

服务器是假设在本机的,本机能正常访问该页,可见排除被该网站封IP的可能。怀疑是fsockopen的问题

想问问高手们能不能用fsockopen函数正确获得该网页,望多多赐教啊!

------解决方案--------------------
又是appid 又是 login_sig...我们没办法给你做测试的,除非有人以前做过并且成功了
------解决方案--------------------
直接浏览器访问,得
ptui_checkVC('0','!YZG','\x00\x00\x00\x00\x16\x0b\xcd\xd4');
显然是一个 jsonp 应用
echo file_get_contents('http://check.ptlogin2.qq.com/check?regmaster=&uin=369872340&appid=549000912&js_ver=10049&js_type=1&login_sig=4aNczek7pQ2h04JL8nS0xfDqPQsJ-oF5czyfk1lOAY47-HswQg3rmElsCZ6QIAyO&u1=http%3A%2F%2Fqzs.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&r=0.42962526359176423');

ptui_checkVC('1','FT8RVzgWagPfnzHuLXG9LOxegxgkseUV','\x00\x00\x00\x00\x16\x0b\xcd\xd4');

....
------解决方案--------------------
$host = 'check.ptlogin2.qq.com';
$param = '/check?regmaster=&uin=369872340&appid=549000912&js_ver=10049&js_type=1&login_sig=4aNczek7pQ2h04JL8nS0xfDqPQsJ-oF5czyfk1lOAY47-HswQg3rmElsCZ6QIAyO&u1=http%3A%2F%2Fqzs.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&r=0.42962526359176423';

$out = array(
  "GET $param HTTP/1.0",
  "Host: $host",
  'Connection: Close',
  '', ''
);
$fp = fsockopen($host, 80, $errer, $errno, 1);
fwrite($fp, join("\r\n", $out) );
while(! feof($fp)){
  echo fread($fp, 1024);
}
HTTP/1.1 200 OK
Server: tencent http server
Pragma: No-cache
P3P: CP="CAO PSA OUR"
Set-Cookie: confirmuin=0; PATH=/; DOMAIN=ptlogin2.qq.com;
Set-Cookie: ptvfsession=ec74c1fdab7c67a28e60e26b39ca2cd789648df0341f311ebd4a970791b4e4af72576feb6fc4abf6e403d3a52ff4ccd5; PATH=/; DOMAIN=ptlogin2.qq.com;
Set-Cookie: ptisp=ctc; PATH=/; DOMAIN=qq.com;
Connection: close
Content-Type: application/x-javascript; charset=utf-8

ptui_checkVC('0','!WKV','\x00\x00\x00\x00\x16\x0b\xcd\xd4');

------解决方案--------------------
<Directory />
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     Deny&nb