php fsockopen伪造post与get方法的详解

yipeiwu_com6年前PHP代码库
fsockopen 伪造 post和get方法哦,如果你正在找 伪造 post和get方法的php处理代码这款不错哦。
复制代码 代码如下:

<?php
//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.0rn";
   $head .= "Host: ".$info['host']."rn";
   $head .= "rn";
   $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.0rn";
   $head .= "Host: ".$info['host']."rn";
   $head .= "Referer: http://".$info['host'].$info['path']."rn";
   $head .= "Content-type: application/x-www-form-urlencodedrn";
   $head .= "Content-Length: ".strlen(trim($query))."rn";
   $head .= "rn";
   $head .= trim($query);
   $write = fputs($fp, $head);
   while (!feof($fp))
   {
    $line = fread($fp,4096);
    echo $line;
   }
}
?>

相关文章

启用OPCache提高PHP程序性能的方法

启用OPCache提高PHP程序性能的方法

说明 PHP 5.5+版本以上的,可以使用PHP自带的opcache开启性能加速(默认是关闭的)。对于PHP 5.5以下版本的,需要使用APC加速,这里不说明,可以自行上网搜索PHP A...

PHP实现动态柱状图改进版

PHP实现动态柱状图改进版

本文实例分析了PHP实现动态柱状图的改进版。分享给大家供大家参考。具体分析如下: 前面已经写过如果只做动态柱状图的情况,其实原理还是很简单的。因为昨天下午有新的需求,今天上午又修改了一番...

escape unescape的php下的实现方法

function escape($str) {   preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$s...

mongo Table类文件 获取MongoCursor(游标)的实现方法分析

MongoCursor Object 游标类MongoConfig.php配置文件Table.php(mongodb操作数据库类文件)Config.php配置文件复制代码 代码如下:&l...

php使用str_replace替换多维数组的实现方法分析

本文实例讲述了php使用str_replace替换多维数组的实现方法。分享给大家供大家参考,具体如下: 在php中,如果使用str_replace替换数组中的字符串,只能替换一维的数组,...