1. 程式人生 > >圖靈機器人API,適用於微信、微博、QQ群、智能硬件等

圖靈機器人API,適用於微信、微博、QQ群、智能硬件等

語音 init statistic 天氣 curl 查看 syn weight net

該API有智能聊天、查天氣、查快遞、查菜譜、查車票、查航班、查出行、查周邊等近500個功能,能夠用在微信公眾平臺、QQ群、手機語音助手、智能硬件等領域\

[1].[代碼]?[PHP]代碼?跳至?[1]?[2]

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <?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;

[2].[圖片]?截圖.jpg?跳至?

code=44584#62547" style="font-weight:normal;font-size:9pt;text-decoration:none;">[1]?[2]

技術分享圖片

圖靈機器人API,適用於微信、微博、QQ群、智能硬件等