Recently learned from friends that such a free platform is said to be the most intelligent robot in Chinese language context. have been using the platform to get a chat robot to play. The code from the Turing machine Person official website Access document, is an API port call way, can call the Turing machine person, uses in the development website customer service, the third party platform, the QQ robot and so on, this API's access and the use is free, and does not limit the frequency, only then to the Turing Machine Person official website registration activates. Please don't call me Lei Feng!
PHP code
$apiKey = "own Appkey"; $apiURL = "Http://www.tuling123.com/openapi/api?key=KEY&info=INFO"; Set up the message header to construct the request packet header ("content-type:text/html; Charset=utf-8 "); $reqInfo = "Tell a joke"; $url = Str_replace ("INFO", $reqInfo, Str_replace ("KEY", $apiKey, $apiURL)); /** method One, use file_get_contents to get the contents of the content * /$res =file_get_contents ($url); Echo $res; /** method Two, using the Curl Library, you need to see if PHP.ini has already opened 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);
Call a powerful AI robot