微软小冰没有api接口,图灵机器人的太垃圾。
这是我自己写的一个接口,大家把那个我试一下
使用方法
get:
http://localhost/xb.php?msg=内容
return:
返回小冰回复的内容
使用前需要获取微博的SUB值,什么是SUB呢?sub也就是你的微博账号登录状态下的cookies。和百度的bduss是同类型的东西
如何获取SUB呢?
打开电脑版weibo.com登录您的帐号。登录成功后打开浏览器开发者工具(审查元素)。
如图所示,查看微博的所有cookies。把sub后面的value值就是SUB.
把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>
回复内容:
微软小冰没有api接口,图灵机器人的太垃圾。
这是我自己写的一个接口,大家把那个我试一下
使用方法
get:
http://localhost/xb.php?msg=内容
return:
返回小冰回复的内容
使用前需要获取微博的SUB值,什么是SUB呢?sub也就是你的微博账号登录状态下的cookies。和百度的bduss是同类型的东西
如何获取SUB呢?
打开电脑版weibo.com登录您的帐号。登录成功后打开浏览器开发者工具(审查元素)。
如图所示,查看微博的所有cookies。把sub后面的value值就是SUB.
把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>
localhost!!!
本地啊 兄弟 你要我们怎么试 I fu le You

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools