使用5118提供的免费API制作长尾词挖掘查询页
5118海量长尾词挖掘API地址(需要登录)
https://www.5118.com/apistore/detail/88a8a6a6-1c9d-e711-b5b0-d4ae52d0f72c/-1
注册登录即可申请免费apikey,每天免费100次调用,返回前100条数据,够够的啦,具体参数说明可到5118API说明页查看。
本站搭建的接口
http://www.mysqlschool.cn/api/keyword.php?key=mysql
5118关键词挖掘API调用代码
<?php
$host = "http://apis.5118.com";
$path = "/keyword/word";
$method = "POST";
$apikey = "你要调用API的apikey";
$headers = array();
array_push($headers, "Authorization:" . $apikey);
//根据API的要求,定义相对应的Content-Type
array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
$querys = "";
$bodys = "keyword=keyword&page_index=page_index";
$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);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
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);
var_dump(curl_exec($curl));
?>
声明:本站(www.mysqlschool.cn)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。