And*_*umm 12 php search curl google-search serp
我的意思是,我可以在google serp页面上指定首选的SERP位置搜索选项.我想有办法让卷曲变成hapenns.
这是一些历史.我在项目中使用了SEOStats.很好.我有一篇关于使用未记录的谷歌搜索参数进行本地搜索的有趣文章UULE
,并用它来获取本地搜索结果.并且它在一段时间内工作正常.然后我要用代理实现获得结果.就是这样.根据同一篇文章的评论中的建议,今天出现了问题.今年充满了惊喜.现在结果UULE
由于某种原因有时使用代理忽略参数.它返回代理本地结果.但没有代理就没关系.
所以,我必须猜测.
应该每次都有相同的额外请求(我已经设计了这个,请看下面的代码)用户进程设置当前位置或者可能是我错过了一些请求标题或者是最简单的方法而且我有点愚蠢?
// Setting location like a boss
$randomKey = mt_rand(1111,999999);
// SEOStats Curl wrapper
$test = static::gCurl("?q=testing" . $randomKey . "#q=testing". $randomKey, false, Config\DefaultSettings::ALLOW_GOOGLE_COOKIES, $proxy );
$q = explode(";;--;;", $test);
preg_match("/;sig=(.*?)\"/i", $test, $out);
$key = $out[1];
//Suggested Google Geocoder location
$zc = (!empty($location)) ? urlencode($location) : urlencode("Home sweet home");
$url = "https://www.google." . Config\DefaultSettings::GOOGLE_TLD . "/" . "uul?muul=4_18&luul=$zc&uulo=1&usg=$key&hl=ru";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// There should be magic not tested yet
Run Code Online (Sandbox Code Playgroud)
是的,您可以,您应该使用本地域(您已经使用)和cr
GET 参数来设置默认国家/地区以及匹配hl
参数来设置默认语言。
然后你会得到如下 URL:
https://www.google.nl/search?cr=countryNL&hl=nl&num=50&q={your keyword}
Run Code Online (Sandbox Code Playgroud)