} #Umkreis ## Geonames require_once 'pear/geonames/Services/GeoNames.php'; $geo = new Services_GeoNames(); $splz = $_GET['splz']; if ($splz == "" || ctype_digit($splz) == true || $splz == "PLZ bzw. Ort") { $splz = (int) trim($_GET['splz']); } else { $splz = trim($_GET['splz']); } #echo $splz; if ($splz != "" or $splz != "PLZ bzw. Ort") { $umkreis = $_GET['umkreis']; try { $postalCodes = $geo->findNearbyPostalCodes(array('placename' => $splz, 'radius' => $umkreis, 'maxRows' => 200)); #echo "List of postal codes near by in a radius of 10km:\n"; foreach ($postalCodes as $code) { # printf(" - %s (%s)\n", $code->postalCode, $code->placeName); $postleitzahlen = $postleitzahlen . $code->postalCode . ","; } $postleitzahlen = "(" . substr($postleitzahlen, 0, -1) . ")"; #$sstring = " where plz = ".$splz." "; $sstring = " where plz in " . $postleitzahlen . " "; #echo $sstring; } catch (Exception $e) { #echo 'Exception abgefangen: ', $e->getMessage(), "\n"; $antwort = " Kein(e) Therapeut(in) in Umkreis von " . $umkreis . " km, bitte versuchen Sie es nochmals"; } } #else
* @filesource */ /** * Include the geonames package. */ require_once 'Services/GeoNames.php'; $geo = new Services_GeoNames(); // search for all cities named 'Paris' $cities = $geo->search(array('name_equals' => 'Paris')); echo "List of cities named Paris:\n"; foreach ($cities as $city) { printf(" - %s (%s)\n", $city->name, $city->countryName); } echo "\n"; // find all postal codes near by "Toulouse" in a radius of 10km $postalCodes = $geo->findNearbyPostalCodes(array('lat' => 43.606, 'lng' => 1.444, 'radius' => 10, 'maxRows' => 100)); echo "List of postal codes near by Toulouse in a radius of 10km:\n"; foreach ($postalCodes as $code) { printf(" - %s (%s)\n", $code->postalCode, $code->placeName); } echo "\n"; // get the list of all countries and capitals in spanish $countries = $geo->countryInfo(array('lang' => 'es')); echo "List of all countries in spanish language:\n"; foreach ($countries as $country) { printf(" - %s (capital: %s)\n", $country->countryName, $country->capital); } echo "\n"; // get the neightbours countries of France $array = $geo->countryInfo(array('country' => 'FR')); $france = $array[0];