/** * Send request to OSM server and return the response. * * @param string $url URL * @param string $method GET (default)/POST/PUT * @param string $user user (optional for read-only actions) * @param string $password password (optional for read-only actions) * @param string $body body (optional) * @param array $post_data (optional) * @param array $headers (optional) * * @access public * @return HTTP_Request2_Response * @todo Consider just returning the content? * @throws Services_OpenStreetMap_Exception If something unexpected has * happened while conversing with * the server. */ public function getResponse($url, $method = HTTP_Request2::METHOD_GET, $user = null, $password = null, $body = null, array $post_data = null, array $headers = null) { $arguments = array($url, $method, $user, $password, $body, implode(":", (array) $post_data), implode(":", (array) $headers)); $id = md5(implode(":", $arguments)); $data = $this->cache->get($id); if ($data) { $response = new HTTP_Request2_Response(); $response->setStatus(200); $response->setBody($data); return $response; } $response = parent::getResponse($url, $method, $user, $password, $body, $post_data, $headers); $this->cache->save($id, $response->getBody()); return $response; }