I need to somehow receive the issuance of search requests and then process them on my own. Search queries should be processed, say as if they were entered in Beijing, how can this be done? For example, use nslookup etc.
- Do you do this for yandex? He also has his own tools there - Saidolim
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦
|
1 answer
To determine the location of the client by his ip address, you can use standard PHP methods: http://php.net/manual/ru/book.geoip.php http://php.net/manual/ru/function.geoip-region -by-name.php
<?php $region = geoip_region_by_name('www.example.com'); if ($region) print_r($region); ?> Or write something similar with requests for third-party services.
<?php if( $curl = curl_init() ) { $ip = $_SERVER["REMOTE_ADDR"]; curl_setopt($curl, CURLOPT_URL, 'http://ip-whois.net/ip_geo.php?ip='.$ip); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); $out = curl_exec($curl); $matches = array(); $country = preg_match_all("/Страна: (.*)/i", $out, $matches); print_r($matches[1][1]); curl_close($curl); } ?> Also at Habr, this has been discussed more than once: http://habrahabr.ru/post/138067/
- Thanks for the link geoip.php on the new methods are designed to get more detailed information about the user, I need not know his position, but let's say I enter a request on my site - and my script goes to 'China' and enters this request there - the result I myself am already interpreting - yarik
- The question is how to make the script go to China and make a request from there - yarik
- You can determine the user's region and use the conditional operators to send the client or send his request to the server you need. - Konstantin Kulakov
- Thanks for the links, but the question is not to determine from where the user is. The question is to get rid of his request through Google, say Google and return it to me ... Thank you - yarik
- As I understand it, you want to send user requests to different servers depending on their geo location? - Konstantin Kulakov
|