php fsockopen偽造post與get方法的詳解
更新時(shí)間:2013年06月14日 16:24:29 作者:
本篇文章是對(duì)php中fsockopen偽造post與get的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
fsockopen 偽造 post和get方法哦,如果你正在找 偽造 post和get方法的php處理代碼這款不錯(cuò)哦。
<?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;
}
}
?>
復(fù)制代碼 代碼如下:
<?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;
}
}
?>
相關(guān)文章
Yii2——使用數(shù)據(jù)庫操作匯總(增刪查改、事務(wù))
本篇文章主要介紹了Yii2——使用數(shù)據(jù)庫操作匯總,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-12-12用PHP ob_start()控制瀏覽器cache、生成html實(shí)現(xiàn)代碼
Output Control 函數(shù)可以讓你自由控制腳本中數(shù)據(jù)的輸出。它非常地有用,特別是對(duì)于:當(dāng)你想在數(shù)據(jù)已經(jīng)輸出后,再輸出文件頭的情況。2010-02-02php的日期處理函數(shù)及uchome的function_coomon中日期處理函數(shù)的研究
經(jīng)常在用php的時(shí)候會(huì)碰到一個(gè)關(guān)于時(shí)間日期的問題還有時(shí)區(qū)差異的問題,以前作項(xiàng)目的時(shí)候會(huì)把時(shí)間搞錯(cuò),要么就是提前八小時(shí)了,要么那個(gè)時(shí)間就是驢唇不對(duì)馬嘴的,現(xiàn)在我就來深入研究一下這里面的各個(gè)函數(shù)及其用法2011-01-01