API收藏

2021-01-22 15:13

阅读:701

标签:bag   pre   adp   arc   ati   分类   curl   教育   查询   

1.百度图片api

get 方法
$word = ‘北海‘;//要搜索的词
$num = 3;//要搜索的数量
$url = ‘https://image.baidu.com/search/acjson?tn=resultjson_com&ipn=rj&ct=201326592&is=&fp=result&queryWord=‘.$word.‘&cl=2&lm=-1&ie=utf-8&oe=utf-8&adpicid=&st=-1&z=&ic=0&hd=&latest=&copyright=&word=‘.$word.‘&s=&se=&tab=&width=&height=&face=0&istype=2&qc=&nc=1&fr=&expermode=&force=&pn=60&rn=‘.$num;

2.图灵机器人api

 curl post 方法

//请求图灵接口
$msg = ‘你好‘;//发送的对话
$apikey //你的图灵apikey 去图灵官网注册可得
$userid //你的图灵userid
$url = ‘http://openapi.tuling123.com/openapi/api/v2‘;
$data = [
‘reqType‘ => 0,
‘perception‘ => [
‘inputText‘ => [
‘text‘ => $msg,//文本
//图片
‘inputImage‘ => [
‘url‘ => ‘imageUrl‘
],
],
],
//客户端属性
‘selfInfo‘ => [
‘location‘ => [
‘city‘ => ‘玉林‘,
‘province‘ => ‘广西‘,
‘street‘ => ‘教育中路299号‘
],
],

‘userInfo‘ => [
‘apiKey‘ => $apikey,
‘userId‘ => $userid
],
];
//curl方法 post
$res = curl_go($url, json_encode($data), 1);

3.垃圾分类api

$word = ‘西瓜‘;//你搜索的垃圾

$url = ‘https://service.xiaoyuan.net.cn/garbage/index/search?kw=‘.$word;

返回例子:

{"code":1,"msg":"查询到9条数据","data":[{"id":3515,"name":"西瓜","type":2,"category":"湿垃圾","remark":"","num":171},{"id":3516,"name":"西瓜子","type":2,"category":"湿垃圾","remark":"","num":171},{"id":3517,"name":"西瓜子壳","type":2,"category":"湿垃圾","remark":"","num":171},{"id":3518,"name":"西瓜片","type":2,"category":"湿垃圾","remark":"","num":171},{"id":3519,"name":"西瓜皮","type":2,"category":"湿垃圾","remark":"","num":185},{"id":3522,"name":"西瓜籽","type":2,"category":"湿垃圾","remark":"","num":165},{"id":3523,"name":"西瓜霜","type":4,"category":"有害垃圾","remark":"","num":165},{"id":3524,"name":"西瓜霜含片","type":4,"category":"有害垃圾","remark":"","num":165},{"id":3525,"name":"西瓜霜含片塑料铝箔包装","type":4,"category":"有害垃圾","remark":"","num":165}]}

API收藏

标签:bag   pre   adp   arc   ati   分类   curl   教育   查询   

原文地址:https://www.cnblogs.com/youantianqin/p/12078900.html


评论


亲,登录后才可以留言!