最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php fsockopen 伪造 post和get方法
时间:2010-04-02 编辑:简简单单 来源:一聚教程网
//fsocket模拟post提交
$purl = "http://localhost/netphp/test2.php?uu=rrrrrrrrrrrr";
print_r(parse_url($url));
sock_post($purl,"uu=55555555555555555");
//fsocket模拟get提交
function sock_get($url, $query)
{
$info = parse_url($url);
$fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
$head = "GET ".$info['path']."?".$info["query"]." HTTP/1.0 ";
$head .= "Host: ".$info['host']." ";
$head .= " ";
$write = fputs($fp, $head);
while (!feof($fp))
{
$line = fread($fp,4096);
echo $line;
}
}
sock_post($purl,"uu=rrrrrrrrrrrrrrrr");
function sock_post($url, $query)
{
$info = parse_url($url);
$fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
$head = "POST ".$info['path']."?".$info["query"]." HTTP/1.0 ";
$head .= "Host: ".$info['host']." ";
$head .= "Referer: http://".$info['host'].$info['path']." ";
$head .= "Content-type: application/x-www-form-urlencoded ";
$head .= "Content-Length: ".strlen(trim($query))." ";
$head .= " ";
$head .= trim($query);
$write = fputs($fp, $head);
while (!feof($fp))
{
$line = fread($fp,4096);
echo $line;
}
}
?>
-
下一个: php垃圾回收机制处理办法
相关文章
- PHP输入流 php://input与POST/GET的区别 04-27
- php报错file_get_contents(): php_network_getaddresses问题 09-05
- PHP Warning: file_get_contents failed to open stream解决办法 06-25
- php中func_get_arg,func_get_args,func_num_args实现伪重载 11-07
- php提示Warning: file_get_contents(): couldn’t resolve 07-05
- 解决php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution错误 05-02