Microsoft xiaoice does not have an api interface, and the Turing robot is too spam. This is an interface I wrote by myself. Can you give me a try to get: localhostxb. php? Msg content return: Get the SUB value of Weibo before returning the content replied by xiaoice. What is SUB? Sub...
Microsoft xiaoice does not have an api interface, and the Turing robot is too spam.
This is an interface I wrote by myself. Let's give it a try.
Usage
Get:
Http: // localhost/xb. php? Msg = content
Return:
Return Xiao Bing's reply content
You need to obtain the SUB value of Weibo before use. What is SUB? Sub is the cookie in the logon status of your Weibo account. Similar to Baidu's bduss
How to obtain SUB?
Open weibo.com on your computer to log on to your account. After successful logon, open the browser developer tool (Review element ).
To view all cookies on Weibo. The value after sub is SUB.
Paste sub into the following code. Note that SUB must be capitalized.
Format: SUB =
It's not over yet. Open http://weibo.com/weiruanxiaobingand click on the Weibo website.
Then, send a private message to her.
He will reply to you asking you to get her, bind your mobile phone number, and you will be able to get it successfully.
After receiving the message, you can use the preceding interface to chat,
Below is my code
"$ Contents", 'rl '=> '2', 'uid' => '000000', 'send' => 'send '); // curl sends the message in simulated mode if ($ _ GET [msg]) {} else {echo 'the content you submitted is blank! '; Exit;} $ curl = curl_init (); // initialize the curl module curl_setopt ($ curl, CURLOPT_URL ,' http://weibo.cn/msg/do/post?st=7b1272 '); // The submitted login address curl_setopt ($ curl, CURLOPT_HEADER, 0); // whether to display the header information curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 ); // whether to automatically display the returned information curl_setopt ($ curl, CURLOPT_COOKIE, SUB); curl_setopt ($ curl, CURLOPT_COOKIEJAR, $ cookie ); // set the Cookie information to save in the specified file: curl_setopt ($ curl, CURLOPT_POST, 1); // submit curl_setopt ($ curl, CURLOPT_POSTFIELDS, http_build_query ($ post) in post mode )); // curl_setopt ($ curl, CURLOPT_FOLLOWLOCATION, 1); curl_exec ($ curl); // execute cURL curl_close ($ curl); // disable cURL resources, and release the system resource sleep (1); // read the reply $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL ,' http://m.weibo.cn/msg/messages?uid=5175429989&page=1 '); Curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, batch, 1); curl_setopt ($ ch, CURLOPT_COOKIE, SUB); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); $ ct = curl_exec ($ ch); curl_close ($ ch); $ ct = json_decode ($ ct, 1); // print_r ($ ct ); $ m = $ ct [data] [0] [text]; // Replace $ m = str_replace ("share voice", "the recipient sends you a speech. ", $ M); $ m = str_replace (" share image "," the recipient sent you an image sound. ", $ M); // The returned echo $ m;?>
Reply content:
Microsoft xiaoice does not have an api interface, and the Turing robot is too spam.
This is an interface I wrote by myself. Let's give it a try.
Usage
Get:
Http: // localhost/xb. php? Msg = content
Return:
Return Xiao Bing's reply content
You need to obtain the SUB value of Weibo before use. What is SUB? Sub is the cookie in the logon status of your Weibo account. Similar to Baidu's bduss
How to obtain SUB?
Open weibo.com on your computer to log on to your account. After successful logon, open the browser developer tool (Review element ).
To view all cookies on Weibo. The value after sub is SUB.
Paste sub into the following code. Note that SUB must be capitalized.
Format: SUB =
It's not over yet. Open http://weibo.com/weiruanxiaobingand click on the Weibo website.
Then, send a private message to her.
He will reply to you asking you to get her, bind your mobile phone number, and you will be able to get it successfully.
After receiving the message, you can use the preceding interface to chat,
Below is my code
"$ Contents", 'rl '=> '2', 'uid' => '000000', 'send' => 'send '); // curl sends the message in simulated mode if ($ _ GET [msg]) {} else {echo 'the content you submitted is blank! '; Exit;} $ curl = curl_init (); // initialize the curl module curl_setopt ($ curl, CURLOPT_URL ,' http://weibo.cn/msg/do/post?st=7b1272 '); // The submitted login address curl_setopt ($ curl, CURLOPT_HEADER, 0); // whether to display the header information curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 ); // whether to automatically display the returned information curl_setopt ($ curl, CURLOPT_COOKIE, SUB); curl_setopt ($ curl, CURLOPT_COOKIEJAR, $ cookie ); // set the Cookie information to save in the specified file: curl_setopt ($ curl, CURLOPT_POST, 1); // submit curl_setopt ($ curl, CURLOPT_POSTFIELDS, http_build_query ($ post) in post mode )); // curl_setopt ($ curl, CURLOPT_FOLLOWLOCATION, 1); curl_exec ($ curl); // execute cURL curl_close ($ curl); // disable cURL resources, and release the system resource sleep (1); // read the reply $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL ,' http://m.weibo.cn/msg/messages?uid=5175429989&page=1 '); Curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, batch, 1); curl_setopt ($ ch, CURLOPT_COOKIE, SUB); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); $ ct = curl_exec ($ ch); curl_close ($ ch); $ ct = json_decode ($ ct, 1); // print_r ($ ct ); $ m = $ ct [data] [0] [text]; // Replace $ m = str_replace ("share voice", "the recipient sends you a speech. ", $ M); $ m = str_replace (" share image "," the recipient sent you an image sound. ", $ M); // The returned echo $ m;?>
Localhost !!!
What do You want us to do? I fu le You