PHP function to check a site position in Google Search Results for an exact phrase
€8-30 EUR
Completed
Posted about 3 years ago
€8-30 EUR
Paid on delivery
$qst is a word (phrase) to search in Google Search Results (test word)
$qsd is a web page url address (https://*.[login to view URL]*)
$num is the amount of results to fetch in SERP
We need you to write
the
function google_pos($qst , $qsd, $num=100) {
must return
a result array
with elements
['0'] - the number of results in SERP per given word when rhe result is valid
or on error
-1 invalid word - if strlen($qst) <3 and >64
-2 invalid url syntax in $qsd
-3 invalid url lenght strlen($qsd <6 and >96)
-4 google do not provide results
i.e. if the web server we are checking from is blocked due to many requests in a short time
['gPosOrg'] - the position where the DOMAIN name is FOUND on the organic search results ($num results per page)
if not found- 0
if found from 1 to $num
['exact'] = 1 if the result matches the full url, 0 if only a domain match
['adwords'] - the amount of results in Google Ads (=0 if no Google paid ads results)
We will use the script in [login to view URL] mainly
with cirilic results
example search url is
$google_url = '[login to view URL]'.str_replace(" ", "%20", $qst).'&num='.$num;
an additional parameter for the page encoiding must be provided as we want to use the script in both
cp1251 and utf8 encoding.
Provide the best available ini_set('user_agent',' ...
and note the script must work as naturaly as possible as we need to check a big amount of words