Is this Microsoft Xiaoice interface useful? Let’s give it a try

  node.js, question

Microsoft Xiaoice has no api interface, Turing robot is too rubbish.
This is an interface I wrote myself. Let’s try it on.

Use method
http://localhost/xb.php? msg=Content
Return to the content of the small ice reply

You need to get the SUB value of microblog before using it. What is SUB? Sub is cookies when your microblog account is logged in. And Baidu’s bduss is the same type of thing
How to get a SUB?
Open the computer version of and log in to your account. After successful login, open the browser developer tool (Review element).

As shown in the figure, check all cookies on Weibo. The value after SUB is sub.
Paste sub into the following code, noting that SUB should be capitalized
Format: SUB=
It’s not over yet. Open it Xiao Bing’s microblog.
Then send her a private letter.
He will reply to you to ask you to collect her, bind your mobile phone number, and you will be able to collect successfully.
After receiving a successful, can use the above interface to chat,

The following is my code

    $cookie = dirname(__FILE__) . '/weibo.tmp';
    $post = array (
         echo '你提交的内容为空!';
    $curl = curl_init();//初始化curl模块
    curl_setopt($curl, CURLOPT_URL, '');//登录提交的地址
    curl_setopt($curl, CURLOPT_HEADER, 0);//是否显示头信息
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//是否自动显示返回的信息
    curl_setopt($curl, CURLOPT_COOKIE, SUB);
    curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie); //设置Cookie信息保存在指定的文件中
    curl_setopt($curl, CURLOPT_POST, 1);//post方式提交
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));//要提交的信息
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, '');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIE, SUB);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $ct = curl_exec($ch);
    echo $m;

localhost! ! !