location api
Posted: Mon Oct 13, 2014 8:05 am
I was looking at ads on my site, I can do better, why limit my ads to USA residents, when tom dick and harry like in canada and the OK
now i already use Google on my site, I know how to take good advantage of their services
I noticed with them they have some location capacility
X-AppEngine-Country:US
X-AppEngine-Region:ca
X-AppEngine-City:norwalk
X-AppEngine-CityLatLong:33.902237,-118.081733
now all I care is country, I am not flogging coffee to a walk by
then I realized I had yet another idea come to mind, check to see if a given ad is working on the amazon server, sometimes products are removed
now i already use Google on my site, I know how to take good advantage of their services
I noticed with them they have some location capacility
X-AppEngine-Country:US
X-AppEngine-Region:ca
X-AppEngine-City:norwalk
X-AppEngine-CityLatLong:33.902237,-118.081733
now all I care is country, I am not flogging coffee to a walk by
Code: Select all
<?php
echo ' Client IP address: ';
if ( isset($_SERVER["REMOTE_ADDR"]) ) {
echo '' . $_SERVER["REMOTE_ADDR"] . ' ';
} else if ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ) {
echo '' . $_SERVER["HTTP_X_FORWARDED_FOR"] . ' ';
} else if ( isset($_SERVER["HTTP_CLIENT_IP"]) ) {
echo '' . $_SERVER["HTTP_CLIENT_IP"] . ' ';
}
?>
Code: Select all
<!-- http://www.amazon.com/dp/YOUR10DIGITASIN returns http-statuscode=200 if it exists, http-statuscode=404 if it does not -->