php 构造http头 php模拟http请求 伪装头部信息

来源:互联网 发布:c语言简单病毒代码 编辑:程序博客网 时间:2024/05/21 04:18

http://jingyan.baidu.com/article/335530daafcd6019ca41c352.html

<?php

/**

构造 http 请求

 */

$filename="http://sj.mjerp.com/dabenying/?r=site/Userlogin&userName=a";

$host = "sj.mjerp.com";

$url = parse_url($filename);

echo '<pre>';

print_r($url);

$POST = <<<HEADER

GET /dabenying/?r=site/Userlogin&userName=a HTTP/1.1

Accept: text/plain, text/html

Referer: {$referer}

Accept-Language: zh-CN,zh;q=0.8

Content-Type: application/x-www-form-urlencodem 

Set-Cookie: token=value;  pub_sauth1=value;r=site/Userlogin; userName=a; pub_sauth2=value

User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17

Host: {$host}

Content-Length: 0

Pragma: no-cache

Cache-Control: no-cache

Connection: close\r\n

HEADER;

$fp = fsockopen($host,80,$errno,$errstr,30);

if ($fp)

{

echo '======<br>';

fwrite($fp, $POST);

echo 2;;

$result = '';

while(!feof($fp))

{

// receive the results of the request

echo fgets($fp),'<br>';

}

//echo $result;

}else{

echo 'failed';

}

fclose($fp);

0 0
原创粉丝点击