Home > php教程 > php手册 > body text

图灵机器人API,适用于微信、微博、QQ群、智能硬件等

WBOY
Release: 2016-06-06 19:36:48
Original
938 people have browsed it

该API有智能聊天、查天气、查快递、查菜谱、查车票、查航班、查出行、查周边等近500个功能,可以用在微信公众平台、QQ群、手机语音助手、智能硬件等领域 无 ?PHP/**图灵机器人网站:http://www.tuling123.com/**API端口体验链接:http://www.tuling123.com/op

该API有智能聊天、查天气、查快递、查菜谱、查车票、查航班、查出行、查周边等近500个功能,可以用在微信公众平台、QQ群、手机语音助手、智能硬件等领域
<?PHP
/**图灵机器人网站:http://www.tuling123.com
/**API端口体验链接:http://www.tuling123.com/openapi/cloud/proexp.jsp
*/

$apiKey = "自己的appKey"; 
$apiURL = "http://www.tuling123.com/openapi/api?key=KEY&info=INFO";

// 设置报文头, 构建请求报文 
header("Content-type: text/html; charset=utf-8"); 
$reqInfo = "讲个笑话"; 
$url = str_replace("INFO", $reqInfo, str_replace("KEY", $apiKey, $apiURL)); 

/** 方法一、用file_get_contents 以get方式获取内容 */ 
     $res =file_get_contents($url); 
     echo $res; 

/** 方法二、使用curl库,需要查看php.ini是否已经打开了curl扩展 */ 
    $ch = curl_init(); 
    $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
    $file_contents = curl_exec($ch); 
    curl_close($ch); 
    echo $file_contents;
Copy after login
图灵机器人API,适用于微信、微博、QQ群、智能硬件等
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!