5118助手
| 名称 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| keywords | string | 是 | 关键词(最多5个,多个用空格隔开) | |
| exclude_keywords | string | 是 | 过滤词 | |
| max_content_count | int | 是 | 文章段落总字数返回范围(返回字数限制必须小等于3000,大于0) | |
| startTime | string | 是 | yyyy-MM-dd | 开始日期,格式为“yyyy-MM-dd”(不指定默认返回半年内数据) |
| endTime | string | 是 | yyyy-MM-dd | 结束日期,格式为“yyyy-MM-dd”(不指定默认返回半年内数据) |
| scheme | int | 否 | 1 | 方案,1:优选 2:多样化(不指定默认为1) |
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| errcode | string | 0 | 返回的错误代码 |
| errmsg | string | 返回的错误说明 | |
| keywords | string | 关键词 | |
| exclude_keywords | string | 过滤词 | |
| rowcount | int | 文章段落行数 | |
| total | int | 文章段落总字数 | |
| content_count | int | 文章段落字数 | |
| content | string | 文章段落内容 |
{
"errcode": "0",
"errmsg": "",
"data": {
"keywords": "仪器",
"exclude_keywords": "",
"rowcount": 4,
"total": 559,
"result": [
{
"content_count": 63,
"content": "XX仪器检测服务有限公司从事仪器检测,仪器计量,仪器校正,仪器校验,仪器校准的第三方计量实验室。服务全国各个城市,可到厂服务。"
},
{
"content_count": 235,
"content": "2021欢迎访问##XXX仪器设备校准计量器具检测##实业集团仪器设备校准当前,我验检测机构布局不尽合理,仍存在“小、散、弱”现象。具体情况如下:仪器设备是开展科研工作必不可少的硬件支撑,也是促进科研成果转化的重要保障。在这两座大山之下,国内民营第三方检测机构步履维艰。对于那些老环保的人,让我们送上一份理解和支持,相信正是因为有了这么一群人,我国的环保事业才能越来越好。仪器还采用了FlukeIR-Fusion技术,将可见光图像和红外图像组合在一幅图像中,更好清晰度。"
}
...
]
}
}
| 错误码 | 说明 |
|---|---|
| 100101 | 调用次数不够,请充值 |
| 100102 | 服务每秒调用量超限 |
| 100103 | 服务每小时调用量超限 |
| 100104 | 服务每天调用量超限 |
| 100111 | 调用字数不够,请充值 |
| 100201 | url无法解析 |
| 100202 | 请求缺少apikey |
| 100203 | 无效的apikey |
| 100204 | api不存在 |
| 100205 | api已经关闭 |
| 100206 | 后端服务响应status非200 |
| 100207 | 后端服务未正确接入 |
| 100208 | 请求方式不支持 |
| 100301 | Api商城 内部错误 |
| 100302 | 请求后端服务过程中错误 |
| 100303 | 系统繁忙稍候再试 |
| 100403 | 您输入的apikey不正确 |
| 错误码 | 说明 |
|---|---|
| 200107 | 服务器超时 |
| 200110 | 操作异常提示 |
| 200201 | 传进参数为空 |
| 200409 | 最多只能5个关键词 |
| 200505 | 出现异常情况 |
| 2 | 002 | 01 |
|---|---|---|
| 服务器错误(1:为系统级别错误) | 服务模块代码(即数据ID) | 具体错误代码 |
| 名称 | 价格 | 次数 | 说明 |
|---|---|---|---|
| 试用套餐 | 0.00 | 100 | |
| 套餐一 | 500.00 | 10000 | |
| 套餐二 | 3000.00 | 100000 | |
| 套餐三 | 15000.00 | 1000000 |
<?php$curl = curl_init();curl_setopt_array($curl, array(CURLOPT_URL => 'https://apis.5118.com/articlewriter',CURLOPT_RETURNTRANSFER => true,CURLOPT_ENCODING => '',CURLOPT_MAXREDIRS => 10,CURLOPT_TIMEOUT => 0,CURLOPT_FOLLOWLOCATION => true,CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST => 'POST',CURLOPT_POSTFIELDS => 'keywords=keywords&max_content_count=max_content_count',CURLOPT_HTTPHEADER => array('Authorization: 你要调用API的apikey,到 https://account.5118.com/signin/myapi 获取','Content-Type: application/x-www-form-urlencoded',),));$response = curl_exec($curl);curl_close($curl);echo $response;
using System.IO;using System.Text;using System.Net;using System.Net.Security;using System.Security.Cryptography.X509Certificates;private const String host = "http://apis.5118.com";private const String path = "/articlewriter";private const String method = "POST";private const String apikey = "你要调用的接口apikey";static void Main(string[] args){String querys = "";String bodys = "keywords=keywords&max_content_count=max_content_count";String url = host + path;HttpWebRequest httpRequest = null;HttpWebResponse httpResponse = null;if (0 < querys.Length){url = url + "?" + querys;}if (host.Contains("https://")){ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));}else{httpRequest = (HttpWebRequest)WebRequest.Create(url);}httpRequest.Method = method;httpRequest.Headers.Add("Authorization", apikey);//根据API的要求,定义相对应的Content-TypehttpRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";if (0 < bodys.Length){byte[] data = Encoding.UTF8.GetBytes(bodys);using (Stream stream = httpRequest.GetRequestStream()){stream.Write(data, 0, data.Length);}}try{httpResponse = (HttpWebResponse)httpRequest.GetResponse();}catch (WebException ex){httpResponse = (HttpWebResponse)ex.Response;}Console.WriteLine(httpResponse.StatusCode);Console.WriteLine(httpResponse.Method);Console.WriteLine(httpResponse.Headers);Stream st = httpResponse.GetResponseStream();StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));Console.WriteLine(reader.ReadToEnd());Console.WriteLine("\n");}public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){return true;}