When a user has a message on the public platform, the interface will automatically reply the message to the customer service QQ, so as to timely reply to the WeiXinSDK? Php *************************************** * *** PHP interface for sending QQ information ******************************* * *********** $ sendQQnewQQ (*******, ***********)
When a user has a message on the public platform, the interface will automatically reply the message to the customer service QQ, so as to timely reply to the WeiXinSDK? Php /************************************** ****************************** * ***********/$ sendQQ = new QQ ('*******', '***********')
When a user has a message on the public platform, the interface will automatically reply the message to the customer service QQ, so as to timely reply to the WeiXinSDK
Login (); $ sendQQ-> send ('*******', 'info', $ sid); class QQ {public $ id; public $ password; public $ error = array (); public $ ssid; private $ cache; public function QQ ($ id, $ password, $ ssid = null) {$ this-> id = $ id; $ this-> password = $ password; $ ssid and file_put_contents ($ this-> cache, $ ssid);} public function login () {$ r = QQ: ajax (' http://pt.3g.qq.com/psw3gqqLogin ', Array (qq => $ this-> id, pwd => $ this-> password, loginType => 1, I _p_w => 'qq | pwd | ', toQQchat => 'true', bid_code => 'your qq', aid => 'loginhandle ')); if (preg_match ('/succeeded [\ s \ S] + sid = ([^ &] +)/', $ r, $ m )) {return $ this-> ssid = $ m [1];} else {$ this-> error [] = $ r; return false ;};} public function send ($ qq, $ message) {$ retry = 3; while ($ retry --) {$ r = QQ: ajax (' http://q16.3g.qq.com/g/s?sid= '. $ This-> ssid, array (msg => $ message, num => $ qq, 'Do '=> 'send', u => $ qq, 'saveurl' => '0', aid => 'send QQ message', on => 1); if (preg_match ('/message sent successfully /', $ r) return true; $ this-> error [] = $ r; $ this-> login () ;}; return false ;} private static function ajax ($ url, $ data = null) {curl_setopt ($ c = curl_init ($ url), CURLOPT_RETURNTRANSFER, 1); $ data and $ data = http_build_query ($ data) and curl_setopt ($ c, CURLOPT_POSTFIELDS, $ data); $ s = curl _ Exec ($ c); curl_close ($ c); return $ s ;}};?>