5118助手
| 名称 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| keywords | string | 是 | 指定的关键词,多个用“|”隔开(一次最多能提交50个关键词) |
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| errcode | string | 0 | 返回的错误代码 |
| errmsg | string | 返回的错误说明 | |
| taskid | int | 成功返回的任务ID |
{
"errcode": "0",
"errmsg": "",
"data": {
"taskid": 1
}
}
| 名称 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| taskid | int | 是 | 要检测的任务ID |
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| errcode | string | 0 | 返回的错误代码 |
| errmsg | string | 返回的错误说明 | |
| taskid | int | 当前任务ID | |
| keyword | string | 关键词 | |
| index | int | 流量指数 | |
| mobile_index | int | 移动指数 | |
| douyin_index | int | 抖音指数 | |
| haosou_index | int | 360指数 | |
| bidword_kwc | int | 竞价竞争度(1、高 2、中 3、低) | |
| bidword_pcpv | int | PC检索量 | |
| bidword_wisepv | int | 移动检索量 | |
| long_keyword_count | int | 长尾词个数 | |
| bidword_price | int | SEM点击价格 | |
| bidword_company_count | int | 竞价公司数量 |
{
"errcode": "0",
"errmsg": "",
"data": {
"taskid": xxxxxxxx,
"keyword_param": [
{
"keyword": "气相色谱仪",
"index": 330,
"mobile_index": 212,
"haosou_index": 351,
"bidword_kwc": 1,
"bidword_pcpv": 258,
"bidword_wisepv": 372,
"long_keyword_count": 48718,
"bidword_price": 9.30,
"bidword_company_count": 276,
"toutiao_index": 14,
"douyin_index": 564,
"bidword_recommendprice_min": 0.00,
"bidword_recommendprice_max": 10.16,
"age_best": "20-29",
"age_best_value": 54.99,
"sex_male": 48.71,
"sex_female": 51.29,
"bidword_showreasons": "高频热搜词"
}
...
]
}
}
| 错误码 | 说明 |
|---|---|
| 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不正确 |
| 错误码 | 说明 |
|---|---|
| 200104 | 数据获取中 |
| 200107 | 服务器超时 |
| 200201 | 传进参数为空 |
| 200202 | 用户ID为空 |
| 200203 | 请输入要查询的关键词 |
| 200401 | 提交关键词的数量已达上限,一次最多能提交50个关键词 |
| 200405 | 请输入要检测的关键词,多个用“|”隔开 |
| 20040501 | 某关键词长度超过了指定的字符串长度 |
| 20040502 | 如输入多个关键词时请用“|”进行分隔 |
| 2 | 002 | 01 |
|---|---|---|
| 服务器错误(1:为系统级别错误) | 服务模块代码(即数据ID) | 具体错误代码 |
| 名称 | 价格 | 次数 | 说明 |
|---|---|---|---|
| 首次试用套餐 | 0.00 | 100 | |
| 套餐一 | 300.00 | 15000 | |
| 套餐二 | 1200.00 | 150000 | |
| 套餐三 | 6000.00 | 1500000 |
/*提交任务*/<?php$host = "http://apis.5118.com";$path = "/keywordparam/v2";$method = "POST";$apikey = "你要调用API的apikey,到 https://account.5118.com/signin/myapi 获取";$headers = array();array_push($headers, "Authorization:" . $apikey);//根据API的要求,定义相对应的Content-Typearray_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");$querys = "";$bodys = "keywords=电脑|电器|服装";$url = $host . $path;$curl = curl_init();curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);curl_setopt($curl, CURLOPT_FAILONERROR, false);if (1 == strpos("$".$host, "https://")){curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);}curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);curl_exec($curl);?>/*获取结果*/<?php$host = "http://apis.5118.com";$path = "/keywordparam/v2";$method = "POST";$apikey = "你要调用API的apikey,到 https://account.5118.com/signin/myapi 获取";$headers = array();array_push($headers, "Authorization:" . $apikey);//根据API的要求,定义相对应的Content-Typearray_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");$querys = "";$bodys = "taskid=taskid";$url = $host . $path;$curl = curl_init();curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);curl_setopt($curl, CURLOPT_FAILONERROR, false);if (1 == strpos("$".$host, "https://")){curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);}curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);curl_exec($curl);?>
using System.Text;using System.Net;using System.Net.Security;using System.Security.Cryptography.X509Certificates;using Newtonsoft.Json;using System.Threading;public class ResultModel{public string errcode { get; set; }public string errmsg { get; set; }public DataModel data { get; set; }}public class DataModel{public string taskid { get; set; }}private const String host = "http://apis.5118.com";private const String path = "/keywordparam";private const String method = "POST";private const String apikey = "你要调用的接口apikey";private void Form1_Load(object sender, EventArgs e){String querys = "";String bodys = "keywords=keywords";String url = host + path;string str = SendPost(querys, bodys, url);Console.WriteLine(str);Console.WriteLine("\n");ResultModel model = JsonConvert.DeserializeObject<ResultModel>(str);while (true){if (!string.IsNullOrEmpty(model.data.taskid)){bodys = "taskid=taskid";string jsonStr = SendPost(querys, bodys, url);Console.WriteLine(jsonStr);break;}else{Thread.Sleep(60000);str = SendPost(querys, bodys, url);model = JsonConvert.DeserializeObject<ResultModel>(str);}}}private static string SendPost(string querys, string bodys, string url){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"));return reader.ReadToEnd();}public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){return true;}