You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$url = "http://".$_SERVER['SERVER_NAME']."/postcode/". urlencode($postcode) .".csv"; // Build the URL
$file = file_get_contents($url);
if (strpos($file, "html") === FALSE) { // Some error checking - if the file contains html, then we've been redirected to the homepage and something has gone wrong
$pieces = explode(",", $file);
$result['postcode'] = $pieces[0];
$result['lat'] = $pieces[1];
$result['lng'] = $pieces[2];
} else {
$result['error'] = TRUE; // If an error, return one