A Web chat is implemented using the free smart chat interface provided by the Turing robot. If you are interested, you can try talkingrobot. sinaapp. comliangzai. php does not have $ apiKey's own apiKey; $ apiURLwww. tuling123.comopenapiapi? KeyKEYinfoINFO; set the packet header,
With the free intelligent chat interface provided by the Turing robot to achieve a web chat, interested friends can experience, http://talkingrobot.sinaapp.com/liangzai.php without $ apiKey = "your own apiKey "; $ apiURL = "http://www.tuling123.com/openapi/api? Key = KEYinfo = INFO "; // sets the packet header,
With the free intelligent chat interface provided by the Turing robot to achieve a web chat, interested friends can experience, http://talkingrobot.sinaapp.com/liangzai.php
<无>
$ ApiKey = "your own apiKey"; $ apiURL = "http://www.tuling123.com/openapi/api? Key = KEY & info = INFO "; // sets the packet header and constructs the request packet header (" Content-type: text/html; charset = UTF-8 "); $ reqInfo = "joke"; $ url = str_replace ("INFO", $ reqInfo, str_replace ("KEY", $ apiKey, $ apiURL )); /** Method 1: Use file_get_contents to get the content in get mode */$ res = file_get_contents ($ url); echo $ res;/** Method 2: Use the curl library, php. whether the curl extension */$ 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;