Heim >php教程 >php手册 >php fsockopen 伪造 post和get方法

php fsockopen 伪造 post和get方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-25 16:38:241351Durchsuche

<?php 
	//fsocket模拟post提交 
	$purl = "http://localhost/netphp/test2.php?uu=rrrrrrrrrrrr"; 
	print_r(parse_url(http://pic1.phprm.com/2014/09/09/http://pic1.phprm.com/2014/09/09/http://pic1.phprm.com/2014/09/09/$url.jpg.jpg.jpg)); 
	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[&#39;path&#39;]."?".$info["query"]." HTTP/1.0 "; 
	   $head .= "Host: ".$info[&#39;host&#39;]." "; 
	   $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[&#39;path&#39;]."?".$info["query"]." HTTP/1.0 "; 
	   $head .= "Host: ".$info[&#39;host&#39;]." "; 
	   $head .= "Referer: http://".$info[&#39;host&#39;].$info[&#39;path&#39;]." "; 
	   $head .= "Content-type: application/x-www-form-urlencoded "; 
	   $head .= "Content-Length: ".strlen(trim($query))." "; 
	   $head .= " ";//开源代码phprm.com 
	   $head .= trim($query); 
	   $write = fputs($fp, $head); 
	   while (!feof($fp)) 
	   { 
	    $line = fread($fp,4096); 
	    echo $line; 
	   } 
	} 
	 
	

永久链接:

转载随意!带上文章地址吧。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn