GEO targeting php and hostip
I am trying to show/geo target javascript affiliate links for certian countries that my visitors to my site are from.
I have doing a little research on google and have found a few script but for some reason they do not work.
I know about the geoip database from maxmind but I am looking for a remote solution as the geoip database is said to be a heavy strain on servers if you get a lot of visitors. I am hosted on a shared server so I do not want to get my account suspended for over working the server. Also I have a few sites that will use this idea.
This is a script I found whilst googling and all it does is give me an error.
<?php $ip = $_SERVER [ 'REMOTE_ADDR' ]; $country = file_get_contents ( 'http://api.hostip.info/country.php?ip=' . $ip ); if ( $country == "US" ) { echo "<American-English Ringtone Ad Tag>" ; } elseif ( $country == "AU" OR $country == "UK" OR $country == "IE" ) { echo "<British-English Ringtone Ad Tag>" ; } else { echo "<YPN Ad Tag>" ; } ?>
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/username/public_html/webaddress.co.uk/test/test.php on line 7 |
I am using the hostip service.
Any advice would be of great help.
Thanks in advance.
:)
:)