Facebook
Twitter
YouTube
Flickr
OTHER WAYS TO
EXPLORE UNA-USA.ORG:



_sendRequest("address=" . urlencode(stripslashes($address))); } // end forward /** * Reverse search: string must be latitude and longitude * * @param float $lat * @param float $lng * @return obj $response */ public function reverseSearch($lat, $lng) { return $this->_sendRequest("latlng=" . (float) $lat . ',' . (float) $lng); } // end reverse /** * Search Address Components Object * * @param string $type * @return object / false */ public function searchAddressComponents($type) { foreach($this->response->results[0]->address_components as $k=>$found){ if(in_array($type, $found->types)){ return $found; } } return false; } /** * Parse JSON default values: map object values to readable content * * @param none * @return none */ private function _setDefaults() { $country = $this->searchAddressComponents("country"); $this->country_long = $country->long_name; $this->country_short = $country->short_name; $region = $this->searchAddressComponents("administrative_area_level_1"); $this->region_long = $region->long_name; $this->region_short = $region->short_name; $county = $this->searchAddressComponents("administrative_area_level_2"); $this->county_long = $county->long_name; $this->county_short = $county->short_name; $city = $this->searchAddressComponents("locality"); $this->city = $city->short_name; $this->address = $this->response->results[0]->formatted_address; $this->lat = $this->response->results[0]->geometry->location->lat; $this->lng = $this->response->results[0]->geometry->location->lng; $this->location_type = $this->response->results[0]->geometry->location_type; } // end set private function _sendRequest($search) { $api_key = "ABQIAAAA3_nWkOsxM3zcPAWpC_tANxSWHOdgBAC_-eSeGQFhIT_iXwykOhQexr0O47yGDV8Cfefill0WSroN_A"; // format this string with the appropriate latitude longitude #$url = 'http://maps.google.com/maps/geo?q=37.0870821,-76.4730122&output=csv&sensor=true_or_false&key=' . $api_key; $url = 'http://maps.googleapis.com/maps/api/geocode/json?'.$search.'&sensor=true'; echo "
url: ".$url; // make the HTTP request $data = @file_get_contents($url); $this->response = $jsondata = json_decode($data); #echo "
";
		#print_r($jsondata);

		if ($this->response->status == "OK") {
			// set some default values for reading
			$defaults = $this->_setDefaults();
			return $this->response;
		} 
		else 
		{
			echo "Geocoding failed, server responded: " . $this->response->status;
			return false;

		}
 
 
 }
 

 
} // end class


Calendar
search

Search...






No Items Found

There were no items found that match your search criteria. Please revise your search and try again.




The UN Foundation
1750 Pennsylvania Avenue NW
Suite 300
Washington, DC 20006

Tel: +1 202 887-9040
Fax: +1 202 887-9021

801 Second Avenue
9th Floor
New York, NY 10017

Tel: +1 212 697-3315
Fax: +1 212 697-3316

About Us
Contact Us
Programs
Leadership Dinner
Donate
Email Sign-up
Privacy