public function get($address)
    {
        if (empty($address)) {
            throw new \Exception("Address is required in order to process");
        }

        $url = $this->getServiceUrl() . "&address=" . urlencode($address);
        $ch  = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $serviceResults = json_decode(curl_exec($ch));
        if ($serviceResults && $serviceResults->status === 'OK') {
            $this->serviceResults = $serviceResults;

            return new Location($address, $this->serviceResults);
        }

        return new Location($address, new \stdClass);
    }
public function get($address)
    {
        if (empty($address)) {
            throw new \Exception("Address is required in order to process");
        }

        $url = $this->getServiceUrl() . "&address=" . urlencode($address);
        $ch  = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $serviceResults = json_decode(curl_exec($ch));
        if ($serviceResults && $serviceResults->status === 'OK') {
            $this->serviceResults = $serviceResults;

            return new Location($address, $this->serviceResults);
        }

        return new Location($address, new \stdClass);
    }
public function get ( $ address ) { if ( empty ( $ address ) ) { throw new \ Exception ( "Address is required in order to process" ) ; } $ url = $ this -> getServiceUrl ( ) . "&address=" . urlencode ( $ address ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; $ serviceResults = json_decode ( curl_exec ( $ ch ) ) ; if ( $ serviceResults && $ serviceResults -> status === 'OK' ) { $ this -> serviceResults = $ serviceResults ; return new Location ( $ address , $ this -> serviceResults ) ; } return new Location ( $ address , new \ stdClass ) ; }
Sends request to the passed Google Geocode API URL and fetches the address details and returns them

@param $address

@return   bool|object false if no data is returned by URL and the detail otherwise
@throws   \Exception
@internal param string $url Google geocode API URL containing the address or latitude/longitude
Sends request to the passed Google Geocode API URL and fetches the address details and returns them