亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標題: 微信客服之qq消息提醒 [打印本頁]

作者: gemliu    時間: 2015-07-02 11:04
標題: 微信客服之qq消息提醒
當用戶有消息進入微信公眾平臺,讓接口自動回復消息到客服QQ上,達到及時回復的目的
QQ推送消息部分
  1. <?php

  2. /*******************************************
  3. 發(fā)送QQ信息PHP接口
  4. *******************************************/

  5. $sendQQ = new QQ('*******','***********');
  6. $sid = $sendQQ->login();
  7. $sendQQ->send('******','信息',$sid);




  8. class QQ {
  9.   public $id;
  10.   public $password;
  11.   public $error=array();
  12.   public $ssid;
  13.   private $cache;
  14.   public function QQ($id,$password,$ssid=null){
  15.     $this->id=$id;
  16.     $this->password=$password;
  17.     $ssid and file_put_contents($this->cache,$ssid);
  18.   }
  19.      
  20.      
  21.      
  22.   public function login(){
  23.     $r=QQ::ajax(
  24.       'http://pt.3g.qq.com/psw3gqqLogin',
  25.       array(
  26.         qq=>$this->id,pwd=>$this->password,
  27.         loginType=>1,i_p_w=>'qq|pwd|',
  28.         toQQchat=>'true',bid_code=>'3GQQ',
  29.         aid=>'nLoginHandle'
  30.       )
  31.     );
  32.     if(preg_match('/成功[\s\S]+sid=([^&]+)/',$r,$m)){
  33.       return $this->ssid=$m[1];
  34.     }else{
  35.       $this->error[]=$r;
  36.       return false;
  37.     };
  38.   }
  39.          
  40.      
  41.   public function send($qq,$message){
  42.     $retry=3;
  43.     while($retry--){
  44.       $r=QQ::ajax(
  45.         'http://q16.3g.qq.com/g/s?sid='.$this->ssid,
  46.         array(
  47.           msg=>$message,num=>$qq,'do'=>'send',u=>$qq,
  48.           'saveURL'=>'0',aid=>'發(fā)送QQ消息',on=>1
  49.         )
  50.       );
  51.       if(preg_match('/消息發(fā)送成功/',$r))return true;
  52.       $this->error[]=$r;
  53.       $this->login();
  54.     };
  55.     return false;
  56.   }
  57.      
  58.      
  59.      
  60.   private static function ajax($url,$data=null){
  61.     curl_setopt($c=curl_init($url),CURLOPT_RETURNTRANSFER,1);
  62.     $data and $data=http_build_query($data)
  63.           and curl_setopt($c,CURLOPT_POSTFIELDS,$data);
  64.     $s=curl_exec($c);
  65.     curl_close($c);
  66.     return $s;
  67.   }
  68. };


  69. ?>
復制代碼

作者: renxiao2003    時間: 2015-07-10 10:09
能自動泡妞更好啊。




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2