根据关键词获取网站在各大搜索引擎的排名情况
$ composer require tim168/search-engine-rank
require __DIR__ .'/vendor/autoload.php';
use Tim168\SearchEngineRank\SearchEngineRank;
//关键字
$keyword = '华为';
//查询的页码
$page = 1;
//查询的网址
$url = 'https://www.huawei.com/';
//代理ip(若不设置,默认用本地ip)
$proxy = "112.245.21.58:548";
//超时时间
$timeout = 5;
$rank = SearchEngineRank::getRank(\Tim168\SearchEngineRank\Enum\SearchEngineEnum::PC_360, $keyword, $page, $proxy, $url,$timeout);
//返回排名数组
return $rank;
名称 | 标示 | 备注 |
---|---|---|
百度 | SearchEngineEnum::PC_BAI_DU | pc-bai-du |
移动百度 | SearchEngineEnum::M_BAI_DU | m-bai-du |
360 | SearchEngineEnum::PC_360 | pc-360 |
搜狗 | SearchEngineEnum::PC_SOU_GOU | pc-sou-gou |
MIT