Introduction to Turing man PHP API
Turing platform, based on natural language processing, knowledge base and cloud computing technology, for the vast number of developers, partners to provide a range of intelligent semantic processing capabilities (including semantic understanding, intelligent Quiz, knowledge base docking, etc.) service platform. So far, the platform has accumulated nearly capacity corpus and PB level of basic data, the overall accuracy of the test platform has reached more than 90%, and the platform has been applied to HTC's small hi voice assistant, China Telecom's platform, Haier's Intelligent home appliance control system, widely praised by enterprises.
Below is a description of his API:
Here is an excerpt from the official website: http://www.tuling123.com/openapi/cloud/api.jsp?section=9
$apiKey = "own Appkey";
$apiURL = "Http://www.tuling123.com/openapi/api?key=KEY&info=INFO";
Set up the message header to build the request message
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);
echo $file _contents;
return Result:
This is a JSON string, so we just use PHP's JSON to process the string.
Returns the returned result using Json_decode () to return the JSON data $data so that the joke can be output through $data->text.
By the same token, we can $reqInfoThis variable allows users to enter their own, you can create their own interface of the robot.