src/Geocoder.php
private function performRequest($command, $parameters)
        {
        // add the apikey to the parameters
        $parameters["key"] = $this->api_key;

        // make an array out of the dictionary so that each element is a key value pair glued together with an '=', and urlencode the parameters
        $param_array = array();
        foreach ($parameters as $key=>$value)
            $param_array[] = "$key=" . urlencode($value);

        // glue the array together unto a string with elements connected with '&'
        $params = implode("&", $param_array);

        // put the whole URL together now
        $url = $this->base_url . $command . "?" . $params;

        // cal the server
        $json = $this->call($url);

        $data = json_decode($json, true);

        if (isset($data["error"]))
          {
          $this->error["code"]    = $data["error"]["code"];
          $this->error["message"] = $data["error"]["message"];
          $data = false;
          }

        return $data;
        }
private function performRequest($command, $parameters)
        {
        // add the apikey to the parameters
        $parameters["key"] = $this->api_key;

        // make an array out of the dictionary so that each element is a key value pair glued together with an '=', and urlencode the parameters
        $param_array = array();
        foreach ($parameters as $key=>$value)
            $param_array[] = "$key=" . urlencode($value);

        // glue the array together unto a string with elements connected with '&'
        $params = implode("&", $param_array);

        // put the whole URL together now
        $url = $this->base_url . $command . "?" . $params;

        // cal the server
        $json = $this->call($url);

        $data = json_decode($json, true);

        if (isset($data["error"]))
          {
          $this->error["code"]    = $data["error"]["code"];
          $this->error["message"] = $data["error"]["message"];
          $data = false;
          }

        return $data;
        }
private function performRequest ( $ command , $ parameters ) { // add the apikey to the parameters $ parameters [ "key" ] = $ this -> api_key ; // make an array out of the dictionary so that each element is a key value pair glued together with an '=', and urlencode the parameters $ param_array = array ( ) ; foreach ( $ parameters as $ key => $ value ) $ param_array [ ] = "$key=" . urlencode ( $ value ) ; // glue the array together unto a string with elements connected with '&' $ params = implode ( "&" , $ param_array ) ; // put the whole URL together now $ url = $ this -> base_url . $ command . "?" . $ params ; // cal the server $ json = $ this -> call ( $ url ) ; $ data = json_decode ( $ json , true ) ; if ( isset ( $ data [ "error" ] ) ) { $ this -> error [ "code" ] = $ data [ "error" ] [ "code" ] ; $ this -> error [ "message" ] = $ data [ "error" ] [ "message" ] ; $ data = false ; } return $ data ; }
Prepare the call to the API server
Prepare the call to the API server