教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php 模拟 post与浏览器请求数据

php 模拟 post与浏览器请求数据

发布时间:2016-10-27   编辑:jiaochengji.com
教程集为您提供php 模拟 post与浏览器请求数据等资源,欢迎您收藏本站,我们将为您提供最新的php 模拟 post与浏览器请求数据资源

]<?php
$host = "www.123cha.com";
$referer = "http://".$host;
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp){
        echo "$errstr ($errno)<br>;n";
}else{
$request = "
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */"."*
Referer: http://$host
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: $host
Connection: Close"
."rnrn";


fputs ($fp, "$request");
while (!feof($fp))
{
   $res[] = fgets($fp,1024);
}
$html = join("",$res);
fclose ($fp);
$fp = file_put_contents("123cha.html",$html);
echo "done";
}[/

您可能感兴趣的文章:
python中的post是什么
PHP-curl通过GET或POST方式实现http及https请求
PHP模拟POST提交的示例代码
php curl模拟post请求的例子
php 模拟 post与浏览器请求数据
php中在虚拟机环境下使用xdebug注意事项
php fsockopen模拟POST提交的代码
php写的http请求封装类
php cURL https链接报错:Unknown SSL protocol error in connection to
php模拟多线程的实例分享

[关闭]
~ ~