欧美精品亚洲精品日韩经典,午夜秒播,国产福利精品一区二区,亚洲国产成人精品久久,亚洲免费专区,国产精品国产三级国产a,日韩福利网站

龍巖易富通網(wǎng)絡(luò )科技有限公司

龍巖小程序開(kāi)發(fā),龍巖分銷(xiāo)系統

php模擬提交數據

2015.09.10 | 588閱讀 | 0條評論 | php

php利用fsockopen模擬提交數據,以下舉例是模擬提交龍巖seo留言板 

[php] 

$sock = fsockopen("m.n6224.com", 80, $errno, $errstr, 30); 

if (!$sock) die("$errstr ($errno)\n"); 

$data = "comment=龍巖seo&author=test&email=test@qq.com&url=http%3A%2F%2F0597seo.com&comment_post_ID=374&comment_parent=0&comment_post_ID=374"; 

fwrite($sock, "POST /wp-comments-post.php HTTP/1.0\r\n"); 

fwrite($sock, "Host: m.n6224.com\r\n"); 

fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");

fwrite($sock, "Content-length: " . strlen($data) . "\r\n");

fwrite($sock, "Accept: */*\r\n"); 

fwrite($sock, "\r\n"); 

fwrite($sock, "$data\r\n"); 

fwrite($sock, "\r\n"); 

$headers = ""; 

while ($str = trim(fgets($sock, 4096)))     

   $headers .= "$str\n"; echo "\n"; $body = ""; 

   while (!feof($sock))     

      $body .= fgets($sock, 4096); 

   fclose($sock); 

   echo $body; 

[/php]


贊 (

發(fā)表評論