php-micro-mail PHP server-side call Turing man interface failed

Source: Internet
Author: User
Keywords Interface php Turing robot
Tags php server
Interface php Turing robot

Use the official demo but did not succeed, ask the great God pointing Ah!

protected function Talk ($content) {
$key = ' xxxxxxx '; Fill in your apikey here
$re = Json_decode (file_get_contents (' http://www.tuling123.com/openapi/api?key= '. $key. ' &info= '. $content), true);
$code = $re [' Code '];
Switch ($code) {
Case 100000:
$content = $re [' text '];
Break

    case 305000:        $list = $re['list'];        $i = rand(0,count($list)-1);        $list = $list[$i];        $content = '起始站:'.$list['start'].',到达站:'.$list['terminal'].',开车时间:'.$list['starttime'].',到达时间:'.$list['endtime'].'。亲,更多信息请上网查询哦!';        break;    case 306000:        $list = $re['list'];        $i = rand(0,count($list)-1);        $list = $list[$i];        $content = '航班:'.$list['flight'].',航班路线:'.$list['route'].',起飞时间:'.$list['starttime'].',到达时间:'.$list['endtime'].'。亲,更多信息请上网查询哦!';        break;    case 40004:        $content = '今天累了,明天再聊吧';        break;    default:        $content = $re['text'];}return $content;
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.