欢迎访问 生活随笔!

凯发ag旗舰厅登录网址下载

当前位置: 凯发ag旗舰厅登录网址下载 > 编程语言 > php >内容正文

php

qq空间留言板删除 php,php实现qq空间自动回复说说的方法 -凯发ag旗舰厅登录网址下载

发布时间:2023/12/31 php 43 豆豆
凯发ag旗舰厅登录网址下载 收集整理的这篇文章主要介绍了 qq空间留言板删除 php,php实现qq空间自动回复说说的方法 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

本文实例讲述了php实现qq空间自动回复说说的方法。分享给大家供大家参考,具体如下:

header("content-type: text/html; charset=utf-8");

$qq = '';//qq号

$sid = '';//填写sid的值

$con = '';//自定义内容,留空则使用simsimi

$qzone = new qzone($qq,$sid);

class qzone{

private $sid ='';

public function __construct($qq,$sid){

$this->sid = $sid;

$url = "http://ish.z.qq.com/infocenter_v2.jsp?b_uid={$qq}&sid={$sid}&g_ut=2";

$re = $this->fetch($url);

$this->getsaying($re);

}

private function fetch($url,$postdata=null){

$ch = curl_init();//www.oicqzone.com

curl_setopt($ch, curlopt_url,$url);

curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (compatible; msie 10.0; windows phone 8.0; trident/6.0; iemobile/10.0; arm; touch; nokia; lumia 820)");

if($postdata!=null) curl_setopt($ch, curlopt_postfields,$postdata);

curl_setopt($ch, curlopt_returntransfer, 1);

curl_setopt($ch, curlopt_timeout, 20);

$re = curl_exec($ch);

curl_close($ch);

return $re;

}

private function getsaying($html){

preg_match_all('/:(.*?)评论\(\d\)/',$html,$match);

foreach($match[0] as $k){

if(strstr($k,'评论(0)')){

$k = str_replace(php_eol, '', $k);

$k = str_replace(' ', '', $k);

$k = html_entity_decode($k);

preg_match('/:(.*?)/',$k,$content);//www.oicqzone.com

preg_match('/myfeed_mood.jsp\?sid=.*&b_(.*?)&t1_source/',$k,$data);

$content = preg_replace('/] >/', '', $content[1]);

echo '找到一条说说:'.$content.' 机器人的回复是:';

$data = 'b_'.$data[1];

$content = talk($content);

echo $content.'
';

$this->postcomment($content,$data);

sleep(3);

}

}

}

private function postcomment($content,$data){

$postdata = "content={$content}&{$data}&t1_source=1&feedcenter_pn=1&flag=1&type=all&channel=0&back=false&offset=0&ic=false&dl=null&to_tweet=0&submit=评论";

$this->fetch("http://blog30.z.qq.com/mood/mood_reply.jsp?sid={$this->sid}&g_ut=2",$postdata);

}

}

function talk($content){

global $con;

if($con) return $con;

$content = str_replace(' ', '', $content);

$ch = curl_init();

curl_setopt($ch,curlopt_url,'http://www.simsimi.com/talk.htm');

curl_setopt($ch, curlopt_returntransfer, 1);

curl_setopt($ch, curlopt_header,1);

curl_setopt($ch, curlopt_nobody, false);

$rs = curl_exec($ch);

preg_match_all('/set-cookie: (. )=(. )$/m', $rs, $regs);

foreach($regs[1] as $i=>$k);

$cc=str_replace(' path','' ,$k);

$cc='simsimi_uid=507454034223;'.$cc;

$re = httpclient('http://www.simsimi.com/func/reqn?lc=ch&ft=1.0&req='.$content.'&fl=http://www.simsimi.com/talk.htm',$cc);

$re = json_decode($re,true);

return $re['sentence_resp'];

}

function httpclient($url,$cookie){

$ch = curl_init();

curl_setopt($ch, curlopt_url,$url);

curl_setopt($ch, curlopt_cookie,$cookie);

curl_setopt($ch, curlopt_header, 0);

curl_setopt($ch, curlopt_returntransfer, 1);

curl_setopt($ch, curlopt_timeout, 30);

$re = curl_exec($ch);

curl_close($ch);

return $re;

}

?>

希望本文所述对大家php程序设计有所帮助。

总结

以上是凯发ag旗舰厅登录网址下载为你收集整理的qq空间留言板删除 php,php实现qq空间自动回复说说的方法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得凯发ag旗舰厅登录网址下载网站内容还不错,欢迎将凯发ag旗舰厅登录网址下载推荐给好友。

  • 上一篇:
  • 下一篇:
网站地图