public function testUri() { $client = new Client\RestClient('http://framework.zend.com/rest/'); $uri = $client->getUri(); $this->assertTrue($uri instanceof Uri\Uri); $this->assertEquals('http://framework.zend.com/rest/', $uri->toString()); $client->setUri(Uri\UriFactory::factory('http://framework.zend.com/soap/')); $uri = $client->getUri(); $this->assertTrue($uri instanceof Uri\Uri); $this->assertEquals('http://framework.zend.com/soap/', $uri->toString()); $client->setUri('http://framework.zend.com/xmlrpc/'); $uri = $client->getUri(); $this->assertTrue($uri instanceof Uri\Uri); $this->assertEquals('http://framework.zend.com/xmlrpc/', $uri->toString()); }
public function testUri() { $client = new Client\RestClient('http://framework.zend.com/rest/'); $uri = $client->getUri(); $this->assertTrue($uri instanceof URI\URI); $this->assertEquals('http://framework.zend.com/rest/', $uri->generate()); $client->setUri(new Uri\Url('http://framework.zend.com/soap/')); $uri = $client->getUri(); $this->assertTrue($uri instanceof Uri\Url); $this->assertEquals('http://framework.zend.com/soap/', $uri->generate()); $client->setUri('http://framework.zend.com/xmlrpc/'); $uri = $client->getUri(); $this->assertTrue($uri instanceof Uri\Url); $this->assertEquals('http://framework.zend.com/xmlrpc/', $uri->generate()); }
public function findLocationByLocationName($locationName) { //http://maps.google.com/maps/geo?q=Kiev%20/%20Kyiv,%20Ukraine&output=json&oe=utf8 $client = new Rest\Client\RestClient(); $client->setUri("http://maps.google.com"); $client->setHeaders('Accept-Charset', 'ISO-8859-1,utf-8'); $_query = array('q' => $locationName, 'output'=>'json', 'oe'=>'utf8'); $response = $client->restGet('/maps/geo', $_query); $location = Json\Json::decode($response->getBody()); if (empty($location->Placemark)) return null; $placemark = $location->Placemark; if (!count($placemark)) return null; $place = current($placemark); list($long, $lat) = $place->Point->coordinates; return new Location($lat, $long); }