Ai
62 Star 160 Fork 71

dogstar/PhalApi-Library
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Lite.php 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
何军 提交于 2017-11-25 11:41 +08:00 . 图灵机器人接口
<?php
/**
* 图灵机器人接口调用
*
* 参考:http://www.tuling123.com/help/h_cent_webapi.jhtml?nav=doc
*
* @author: andy 2017-11-25
*/
class Tuling123_Lite {
protected $config;
private $tingling123_host = "http://www.tuling123.com/openapi/api";
/**
* @param string $key 图灵机器人key
*/
public function __construct($key = NULL) {
$this->key = $key;
if ($this->key === NULL) {
$this->key = DI()->config->get('app.Tuling123.key');
}
DI()->loader->addDirs('./Library/Tuling123/Tuling123');
}
//组装请求参数
private function getUrl($info)
{
$url = $this->tingling123_host;
$url .= "?";
$url .= "info=" . $info;
$url .= "&key=" . $this->key;
return $url;
}
//发送信息
public function send($info)
{
$url = $this->getUrl($info);
$curl = new PhalApi_CUrl();
$response = $curl->get($url, 3000);
return @json_decode($response, true);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/dogstar/PhalApi-Library.git
git@gitee.com:dogstar/PhalApi-Library.git
dogstar
PhalApi-Library
PhalApi-Library
master

搜索帮助