$map){
echo "
To ". $map . ":
";
//
// The full return provides the scalar number and units
//
$FullResult = MapDistance($origin, $map, $units);
echo $FullResult;
echo "
";
//
// However, the numeric result may require post-processing,
// ereg_replace can be used to isolate the scalar numeric value
//
$NumericResult = ereg_replace("[^0-9]", "", $FullResult);
echo $NumericResult;
//
// ereg_replace cannot be used in the MapDistance() function because if an
// unknown address is entered, the script will fault the loading of the page
//
}
/////////////////////////////////////////////////
//
// This is the the function that gets the information
// Do NOT edit below this line
//
/////////////////////////////////////////////////
function MapDistance($origin, $destination, $units){
//
// Map Distance v1.0a
//
// Map distance was developed by Christopher Wirz (crwirz@gmail.com).
// This PHP function provides driving distance or time; depending on the units.
// Please send any suggestions or changes to the author.
//
//
$origin=str_replace(" ","+",$origin);
$destination=str_replace(" ","+",$destination);
error_reporting(0);
$predata = @fopen("http://www.wirzbrothers.com/distance.php?origin=". $origin . "&destination=" . $destination . "&units=" . $units, "r");
$output = '';
while($buffer = fgets($predata, 4096)){
$output = $output . $buffer;
}
return $output;
}
?>