i have site uses file_get_contents access geolocation api on every request. time time remote api starts giving 504/502 errors, presumably due problems @ end. problem causes site go down - there way create fallback if remote site starts timing out ignore , load page anyway?
this code:
$geodata = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $_server['remote_addr']));
@$geodata = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $_server['remote_addr']));
this ignore errors line throws, , continue.
keep in mind have check if $geodata exists:
if($geodata){ // code }
Comments
Post a Comment