用户协议
移动流量词挖掘API
实时挖掘移动端的有价值流量词
  • API说明
  • 错误码参照
  • 价格与请求限制
  • 示例代码
详细说明: 返回前50000条数据
  • 接口地址:http://apis.5118.com/traffic
  • 返回格式:json
  • 请求方式:POST
  • 在线调试

步骤一:批量提交查询请求,并获得提取结果ID
请求示例:http://apis.5118.com/traffic
提交任务调试工具: Postman示例
提交任务请求参数说明:
名称 类型 必填 默认值 说明
keyword string 关键词
提交任务返回参数说明:
名称 类型 默认值 说明
errcode string 0 返回的错误代码
errmsg string 返回的错误说明
taskid int 提交成功后返回的任务ID
total int 总数量
page_count int 总页数
page_index int 1 当前分页
page_size int 20 每页返回记录的数量(默认返回20条)
JSON返回示例:
{
    "errcode": "200104",
    "errmsg": "数据分析中",
    "taskid": xxxxxx,
    "page_index": 1,
    "page_size": 20,
    "page_count": 0,
    "total": 0,
    "data": []
}

步骤二:根据提取结果ID查询数据是否采集完成,如果完成则得到Json格式结果
由于是实时查询,搜索引擎频率限制以及特定时间API访问量大等原因,数据采集返回在1-10分钟。建议提取任务间隔为60s,如有问题或想提升速度,请联系 客服微信
请求示例:
获取检测结果调试工具: Postman示例
获取检测结果请求参数说明:
名称 类型 必填 默认值 说明
taskid int 任务ID
keyword string 关键词(可输入关键词进行数据获取)
page_index int 1 当前分页
page_size int 20 每页返回数据的数量(最大返回数量500条)
获取检测结果返回参数说明:
名称 类型 默认值 说明
errcode string 0 返回的错误代码
errmsg string 返回的错误说明
taskid int 当前任务ID
page_index int 1 当前分页
page_size int 20 每页返回数据的数量(最大返回数量500条)
page_count int 总页数
total int 总数量
word string 流量词
weight int 价值量
mobile_index int 移动指数
BidWord_WisePv int 移动日检索量
JSON返回示例:
{
    "errcode": "0",
    "errmsg": "",
    "taskid": xxxxxx,
    "page_count": 275,
    "total": 5489,
    "page_index": 1,
    "page_size": 20,
    "data": [
        {
            "word": "xxxxxxx2023年",
            "weight": 81,
            "mobile_index": -1,
            "bidword_wisepv": -1
        },
        {
            "word": "xxxxxxxx行业",
            "weight": 65,
            "mobile_index": -1,
            "bidword_wisepv": -1
        }
		...
		]
}
提交充值订单
状态回调配置说明
服务级错误码参照(error_code):
错误码 说明
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为空
200417 提交任务失败
200504 出现异常情况
错误码格式说明:
2 002 01
服务器错误(1:为系统级别错误) 服务模块代码(即数据ID) 具体错误代码
资费说明:
名称 价格 次数 说明
首次试用套餐 0.00 100
套餐一 4000.00 10000
套餐二 30000.00 100000
示例代码:
                                        

<?php

header("Content-type:text/html; charset=utf-8");

/*参数1:请求的URL;参数2:CURL方式设置http的请求头;参数3:要提交的数据包*/

function doCurlPostRequest($url,$header,$data){

    $ch = curl_init();

    /*请求地址*/

    curl_setopt($ch, CURLOPT_URL, $url);

    /*CURL方式设置http的请求头*/

    curl_setopt($ch, CURLOPT_HTTPHEADER,$header);

    /*文件流形式*/

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    /*发送一个常规的Post请求*/

    curl_setopt($ch, CURLOPT_POST, 1);

    /*Post提交的数据包*/

    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

    return curl_exec($ch);

}

/*请求的URL*/

$url = "https://apis.5118.com/traffic";

/*要提交的数据包*/

$data ="keyword=生活用品";

/*CURL方式设置http的请求头*/

$header[] = "Content-type:application/x-www-form-urlencoded";

/*输入你要调用APIAPIKEY*/

$header[] = "Authorization: APIKEY XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

/*调用CURL POST函数*/

$result=doCurlPostRequest($url,$header,$data);

/* JSON 格式的字符串进行解码,并转换为 PHP 变量*/

$json = json_decode($result);

/*errcode=0 正确返回 errcode=200104 数据采集中*/

$errcode = $json->errcode;

$errmsg = $json->errmsg;

if ($errcode != "0" && $errmsg != "") {

    /*非正确返回*/

    print_r($result);

    exit;

}

/*提交查询请求后获取提取结果的任务ID*/

$taskid = $json->data->taskid; 

if ($taskid != "") {     

    /*要提交的数据包*/

    $data = "taskid=".$taskid;

    /*调用CURL POST函数*/

    $result = doCurlPostRequest($url,$header,$data);

    $json = json_decode($result);

    $errcode = $json->errcode;

    $errmsg = $json->errmsg;   

    /*errcode=200104 数据采集中*/

    if ($errcode == "200104" && $errmsg =="数据采集中") {   

        while(true){

            sleep(5);         

        /*调用CURL POST函数*/       

            $result = doCurlPostRequest($url,$header,$data);

            $errcode = $json->errcode;

            $errmsg = $json->errmsg;           

            /*errcode=0 正确返回*/

            if ($errcode == "0" && $errmsg == "") {               

                print_r($result);               

                /*退出当前的脚本*/

                exit;

            }

        }

    }

    else {

    /*返回数据结果*/

        print_r($result);

    }

}

else {

    /*返回异常或其它信息*/

    print_r($result);

}

/*退出当前的脚本*/

exit;

?>

 


  1. using System.Text;
  2. using System.Net;
  3. using System.Net.Security;
  4. using System.Security.Cryptography.X509Certificates;
  5. using Newtonsoft.Json;
  6. using System.Threading;
  7. public class ResultModel
  8. {
  9. public string errcode { get; set; }
  10. public string errmsg { get; set; }
  11. public string taskid { get; set; }
  12. }
  13. private const String host = "http://apis.5118.com";
  14. private const String path = "/traffic";
  15. private const String method = "POST";
  16. private const String apikey = "你要调用的接口apikey";
  17. private void Form1_Load(object sender, EventArgs e)
  18. {
  19. String querys = "";
  20. String bodys = "checkrow=checkrow&keywords=keywords&url=url";
  21. String url = host + path;
  22. string str = SendPost(querys, bodys, url);
  23. Console.WriteLine(str);
  24. Console.WriteLine("\n");
  25. ResultModel model = JsonConvert.DeserializeObject<ResultModel>(str);
  26. while (true)
  27. {
  28. if (!string.IsNullOrEmpty(model.taskid))
  29. {
  30. bodys = "taskid=taskid&keyword=keyword&page_index=page_index&page_size=page_size";
  31. string jsonStr = SendPost(querys, bodys, url);
  32. Console.WriteLine(jsonStr);
  33. break;
  34. }
  35. else
  36. {
  37. Thread.Sleep(60000);
  38. str = SendPost(querys, bodys, url);
  39. model = JsonConvert.DeserializeObject<ResultModel>(str);
  40. }
  41. }
  42. }
  43. private static string SendPost(string querys, string bodys, string url)
  44. {
  45. HttpWebRequest httpRequest = null;
  46. HttpWebResponse httpResponse = null;
  47. if (0 < querys.Length)
  48. {
  49. url = url + "?" + querys;
  50. }
  51. if (host.Contains("https://"))
  52. {
  53. ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
  54. httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
  55. }
  56. else
  57. {
  58. httpRequest = (HttpWebRequest)WebRequest.Create(url);
  59. }
  60. httpRequest.Method = method;
  61. httpRequest.Headers.Add("Authorization", apikey);
  62. //根据API的要求,定义相对应的Content-Type
  63. httpRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
  64. if (0 < bodys.Length)
  65. {
  66. byte[] data = Encoding.UTF8.GetBytes(bodys);
  67. using (Stream stream = httpRequest.GetRequestStream())
  68. {
  69. stream.Write(data, 0, data.Length);
  70. }
  71. }
  72. try
  73. {
  74. httpResponse = (HttpWebResponse)httpRequest.GetResponse();
  75. }
  76. catch (WebException ex)
  77. {
  78. httpResponse = (HttpWebResponse)ex.Response;
  79. }
  80. Console.WriteLine(httpResponse.StatusCode);
  81. Console.WriteLine(httpResponse.Method);
  82. Console.WriteLine(httpResponse.Headers);
  83. Stream st = httpResponse.GetResponseStream();
  84. StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
  85. return reader.ReadToEnd();
  86. }
  87. public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
  88. {
  89. return true;
  90. }
推荐API
百亿长尾词库,含指数和搜索量
获取域名(含子域名)PC端排名词

系统通知