V
V
vladimirbesk2015-02-01 21:36:28
PHP
vladimirbesk, 2015-02-01 21:36:28

Displaying information from which site the user came from and what keys?

I ran into a problem, when setting up the output of information from which site the user came from and what keys, the Source gives out, but there are no keys, I will be glad for any help from the wp engine.
<?php
if (!isset($_COOKIE['seohvost'])) {
setcookie('seohvost', $_SERVER['HTTP_REFERER']);
}
$referer = (isset($_COOKIE["seohvost"]))? $_COOKIE["seohvost"] : 'Referral link not defined' ;
if (stristr($referer, 'yandex.ru')) { $search = 'text='; $crawler = 'Yandex'; }
if (stristr($referer, 'rambler.ru')) { $search = 'words='; $crawler = 'Rambler'; }
if (stristr($referer, 'google.ru')) { $search = 'q='; $crawler = 'Google';
} if (stristr($referer, 'google.com')) { $search = 'q='; $crawler = 'Google'; }
if (stristr($referer, 'mail.ru')) { $search = 'q='; $crawler = 'Mail.Ru'; }
if (stristr($referer, 'bing.com')) { $search = 'q='; $crawler = 'Bing'; }
if (stristr($referer, 'qip.ru')) { $search = 'query='; $crawler = 'QIP'; }
if (isset($crawler)){
$phrase = urldecode($referer);
preg_match('/'.$search.'([^&]*)', $phrase.'&', $phrase_k);
$phrase = $phrase_k[1];
$referer = $crawler;
}
if(isset($crawler)){
$seacrh = 'Ключи: '.$phrase.' Источник: '.$referer;
}else{
$seacrh = 'Источник: '.$referer;
}
print_r($seacrh);
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mayorovp, 2015-02-02
@vladimirbesk

First, write down the referrers somewhere so that you can read them later. There is a suspicion that the information you need from there is no longer available.
Google out there encrypts the keys for sure, you can only see them through GA.

V
Vladimir, 2015-02-01
@djQuery

If I understood the question correctly, you need to use $_SERVER[QUERY_STRING].
The resulting string can be parsed using explode("&", $query)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question