I was able to use these Stack questions to implement file_get_contents and is_numeric to have the following code successfully provide me a distance in a numerical value between two lat/long points. If the system I'm sending the values to cannot provide a time it outputs a [FAILED] and then I display the text "Unroutable".
This is my working code:
$distance = file_get_contents("http://myserver.com/geo/traveltimes.php?start=".$row["Lat"].",".$row["Lon"]."&dest=".$user["Latitude"].",".$user["Longitude"]."");
$row["Distance"] = is_numeric($distance) ? $distance : "Unroutable";
I'd like as a last ditch effort to reverse the 'start' & 'dest' values to try to see if I can return some numerical results that way.
What is the best way to "trap" a non-numerical value like the [FAILED] and reverse these and THEN display Unroutable if no numerical value is displayed?