Table of Contents
回复内容:
Home Backend Development PHP Tutorial javascript - 这个微软小冰接口有用吗?大家帮我试一下

javascript - 这个微软小冰接口有用吗?大家帮我试一下

Jun 06, 2016 pm 08:08 PM
java javascript node.js php python

微软小冰没有api接口,图灵机器人的太垃圾。
这是我自己写的一个接口,大家把那个我试一下

使用方法
get:
http://localhost/xb.php?msg=内容
return:
返回小冰回复的内容

使用前需要获取微博的SUB值,什么是SUB呢?sub也就是你的微博账号登录状态下的cookies。和百度的bduss是同类型的东西
如何获取SUB呢?
打开电脑版weibo.com登录您的帐号。登录成功后打开浏览器开发者工具(审查元素)。

如图所示,查看微博的所有cookies。把sub后面的value值就是SUB.
javascript - 这个微软小冰接口有用吗?大家帮我试一下
把sub粘贴到下面的代码中,注意是SUB要大写
格式:SUB=
到现在还没有结束,打开http://weibo.com/weiruanxiaobing,关注一下小冰的微博。
然后再给她发一条私信。
他会回复你让你领取她,绑定你的手机号,即可领取成功。
领取成功后,即可使用上面的接口进行聊天、

下面是我的代码

<code><?php //此处新浪微博SUB
   
   
     define('SUB','SUB=******************************************************');
   
   
    //end
    //临时cookies
    $cookie = dirname(__FILE__) . '/weibo.tmp';
    //去除特殊字符
    $contents=htmlspecialchars($_GET[msg]);
    $contents=preg_replace("/\s/","",$contents);
    //post数据
    $post = array (
    'content'=>"$contents",
    'rl'=>'2',
    'uid'=>'5175429989',
    'send'=>'发送'
     );
     //curl模拟发送消息
     if($_GET[msg]){}else{
         echo '你提交的内容为空!';
         exit;
     }
    $curl = curl_init();//初始化curl模块
    curl_setopt($curl, CURLOPT_URL, 'http://weibo.cn/msg/do/post?st=7b1272');//登录提交的地址
    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);
    curl_exec($curl);//执行cURL
    curl_close($curl);//关闭cURL资源,并且释放系统资源
   sleep(1);
 //读取回复
    $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, CURLOPT_RETURNTRANSFER, 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];
    //替换
    $m=str_replace("分享语音","对方给你发送了一段语音。暂时无法显示",$m);
    $m=str_replace("分享图片","对方给你发送了图片音。暂时无法显示",$m);
    //返回的结果
    echo $m;
?></code>
Copy after login
Copy after login

回复内容:

微软小冰没有api接口,图灵机器人的太垃圾。
这是我自己写的一个接口,大家把那个我试一下

使用方法
get:
http://localhost/xb.php?msg=内容
return:
返回小冰回复的内容

使用前需要获取微博的SUB值,什么是SUB呢?sub也就是你的微博账号登录状态下的cookies。和百度的bduss是同类型的东西
如何获取SUB呢?
打开电脑版weibo.com登录您的帐号。登录成功后打开浏览器开发者工具(审查元素)。

如图所示,查看微博的所有cookies。把sub后面的value值就是SUB.
javascript - 这个微软小冰接口有用吗?大家帮我试一下
把sub粘贴到下面的代码中,注意是SUB要大写
格式:SUB=
到现在还没有结束,打开http://weibo.com/weiruanxiaobing,关注一下小冰的微博。
然后再给她发一条私信。
他会回复你让你领取她,绑定你的手机号,即可领取成功。
领取成功后,即可使用上面的接口进行聊天、

下面是我的代码

<code><?php //此处新浪微博SUB
   
   
     define('SUB','SUB=******************************************************');
   
   
    //end
    //临时cookies
    $cookie = dirname(__FILE__) . '/weibo.tmp';
    //去除特殊字符
    $contents=htmlspecialchars($_GET[msg]);
    $contents=preg_replace("/\s/","",$contents);
    //post数据
    $post = array (
    'content'=>"$contents",
    'rl'=>'2',
    'uid'=>'5175429989',
    'send'=>'发送'
     );
     //curl模拟发送消息
     if($_GET[msg]){}else{
         echo '你提交的内容为空!';
         exit;
     }
    $curl = curl_init();//初始化curl模块
    curl_setopt($curl, CURLOPT_URL, 'http://weibo.cn/msg/do/post?st=7b1272');//登录提交的地址
    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);
    curl_exec($curl);//执行cURL
    curl_close($curl);//关闭cURL资源,并且释放系统资源
   sleep(1);
 //读取回复
    $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, CURLOPT_RETURNTRANSFER, 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];
    //替换
    $m=str_replace("分享语音","对方给你发送了一段语音。暂时无法显示",$m);
    $m=str_replace("分享图片","对方给你发送了图片音。暂时无法显示",$m);
    //返回的结果
    echo $m;
?></code>
Copy after login
Copy after login

localhost!!!

本地啊 兄弟 你要我们怎么试 I fu le You

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? Apr 07, 2025 am 12:02 AM

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) Apr 08, 2025 am 12:03 AM

In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

Explain strict types (declare(strict_types=1);) in PHP. Explain strict types (declare(strict_types=1);) in PHP. Apr 07, 2025 am 12:05 AM

Strict types in PHP are enabled by adding declare(strict_types=1); at the top of the file. 1) It forces type checking of function parameters and return values ​​to prevent implicit type conversion. 2) Using strict types can improve the reliability and predictability of the code, reduce bugs, and improve maintainability and readability.

How to use mysql after installation How to use mysql after installation Apr 08, 2025 am 11:48 AM

The article introduces the operation of MySQL database. First, you need to install a MySQL client, such as MySQLWorkbench or command line client. 1. Use the mysql-uroot-p command to connect to the server and log in with the root account password; 2. Use CREATEDATABASE to create a database, and USE select a database; 3. Use CREATETABLE to create a table, define fields and data types; 4. Use INSERTINTO to insert data, query data, update data by UPDATE, and delete data by DELETE. Only by mastering these steps, learning to deal with common problems and optimizing database performance can you use MySQL efficiently.

How to optimize database performance after mysql installation How to optimize database performance after mysql installation Apr 08, 2025 am 11:36 AM

MySQL performance optimization needs to start from three aspects: installation configuration, indexing and query optimization, monitoring and tuning. 1. After installation, you need to adjust the my.cnf file according to the server configuration, such as the innodb_buffer_pool_size parameter, and close query_cache_size; 2. Create a suitable index to avoid excessive indexes, and optimize query statements, such as using the EXPLAIN command to analyze the execution plan; 3. Use MySQL's own monitoring tool (SHOWPROCESSLIST, SHOWSTATUS) to monitor the database health, and regularly back up and organize the database. Only by continuously optimizing these steps can the performance of MySQL database be improved.

How to set up PS feathering? How to set up PS feathering? Apr 06, 2025 pm 07:36 PM

PS feathering is an image edge blur effect, which is achieved by weighted average of pixels in the edge area. Setting the feather radius can control the degree of blur, and the larger the value, the more blurred it is. Flexible adjustment of the radius can optimize the effect according to images and needs. For example, using a smaller radius to maintain details when processing character photos, and using a larger radius to create a hazy feeling when processing art works. However, it should be noted that too large the radius can easily lose edge details, and too small the effect will not be obvious. The feathering effect is affected by the image resolution and needs to be adjusted according to image understanding and effect grasp.

Do mysql need to pay Do mysql need to pay Apr 08, 2025 pm 05:36 PM

MySQL has a free community version and a paid enterprise version. The community version can be used and modified for free, but the support is limited and is suitable for applications with low stability requirements and strong technical capabilities. The Enterprise Edition provides comprehensive commercial support for applications that require a stable, reliable, high-performance database and willing to pay for support. Factors considered when choosing a version include application criticality, budgeting, and technical skills. There is no perfect option, only the most suitable option, and you need to choose carefully according to the specific situation.

How to preview the Bootstrap page How to preview the Bootstrap page Apr 07, 2025 am 10:06 AM

The preview methods of Bootstrap pages are: open the HTML file directly in the browser; automatically refresh the browser using the Live Server plug-in; and build a local server to simulate an online environment.

See all articles