Month: February 2014
-
php fsockopen post data (模拟Post提交)
网上有很多的代码,但是实际上就只有一个,于是乎我一直认为他们是对的,花了一个上午的时间去理顺这个问题,最后我还是在国外的网站上看到了真确的答案,跟大家分享一下: fsockopen页面代码: $fp = fsockopen("example.com", 80); $vars = array( "hello" => "world" ); $content = http_build_query($vars); fwrite($fp,"POST /reposter.php HTTP/1.1\r\n"); fwrite($fp,"Host: example.com\r\n"); fwrite($fp,"Content-Type: application/x-www-form-urlencoded\r\n"); fwrite($fp,"Content-Length: ".strlen($content)."\r\n"); fwrite($fp,"Connection: close\r\n"); fwrite($fp,"\r\n"); fwrite($fp, $content); header("Content-type: text/plain"); while (!feof($fp)) { echo fgets($fp, 1024); } 接受post数据页面的代码: print_r($_POST); 这个是我的fsockopen页面的代码: $domain="127.0.0.1"; $dport="8087"; $vars=array("content"=>"ff"); $post_data=http_build_query($vars); $fp=fsockopen($domain,$dport,$errno,$errstr,1); if($errno!=0) { die("not connect the host");…
-
test
echo "Hello world ! <br/>"; echo "Thanks everybody come to see my little blog , your view is my power . "; echo "This is a test for code plungin ."