帝王谷资源网 Design By www.wdxyy.com

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

<"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"; 
    $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('/<\/a>:(.*"txt-fade">/',$k,$content);//www.oicqzone.com 
        preg_match('/myfeed_mood.jsp\"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=%E8%AF%84%E8%AE%BA"; 
    $this->fetch("http://blog30.z.qq.com/mood/mood_reply.jsp",$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%3A%2F%2Fwww.simsimi.com%2Ftalk.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程序设计有所帮助。

标签:
PHP,QQ空间,自动回复,PHP实现QQ空间自动回复说说

帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。