模拟灌水机器人

/*
Host tencent.com
User_Agent Mozilla/5.0 (windows;U; windows NT 6.1 ;ZH-CN;rv:1.9.2.13
Accept text/html,application/xhtml+xml,application/xml
Accept-Language zh-ch,zh;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset GB2312,utf-8
Keep-Alive 115
Connection keep-alive
Referer http://***.com
Cookie ****************************
*/

<?php
$data =array('author'=> '熊猫大侠','email'=> '[email protected]', 'text'=> '来灌水,无人能挡');
$data = http_bulid_query($data);
$opts = array(

'http' = >array(
'method' => 'Post',
'header' => 'Content-type:application/x-www.form-urlencoded\r\n' ,
'Content-lengtn:' .strlen($data)."\r\n",
'Cookie:PHPSESSID=15TUO632GKS876'.'\r\n'
'User-Agent: Mozilla/5.0 (windows;U; windows NT 6.1 ;ZH-CN;rv:1.9.2.13',
'Referer: http://yahoo.com/content/7/index.php'.'\r\n',
'content' => $data
)
);


$context = stream_context_create($opts);
$html = @file_get_contents("http://yahoo.com/content/7/index.php/comment",false,$content);
?>

猜你喜欢

转载自e4222014.iteye.com/blog/2082381