Hi guys, I'm testing the code explained in: http://bakery.cakephp.org/articles/view/geocoding-in-cakephp
Can anyone help me? And I am getting these errors: Notice (8): Undefined index: scheme [CORE\cake\libs\http_socket.php, line 268] Context | Code $path = "http://maps.google.com/maps/geo?&q=1600%20Pennsylvania%20Ave. %20Washington%20DC %20USA&output=csv&key=ABQIAAAAn0kmVahg_WhO0jCT8Z8MkBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS- Zl837z60cpTjKeSeelhEJVmNOQ" $options = array("method" => "GET") * @todo check if somebody might have passed a fully qualified URL as a $path and don't prepent the scheme/host in those cases */ // Set's the URI for this request $this->setURI($this->config['scheme'].'://'.$this- >config['host'].$path); } HttpSocket::request() - CORE\cake\libs\http_socket.php, line 268 HttpSocket::get() - CORE\cake\libs\http_socket.php, line 320 GeocodedBehavior::_geocoords() - CORE\app\models\behaviors \geocoded.php, line 113 GeocodedBehavior::geocode() - CORE\app\models\behaviors\geocoded.php, line 87 Model::call__() - CORE\cake\libs\model\model.php, line 477 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 46 Location::geocode() - [internal], line ?? LocationsController::index() - CORE\app\controllers \locations_controller.php, line 16 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323 [main] - CORE\app\webroot\index.php, line 83 Warning (2): parse_url(://localhosthttp://maps.google.com/maps/geo? &q=1600%20Pennsylvania%20Ave.%20Washington%20DC %20USA&output=csv&key=ABQIAAAAn0kmVahg_WhO0jCT8Z8MkBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS- Zl837z60cpTjKeSeelhEJVmNOQ) [function.parse-url]: Unable to parse URL [CORE\cake\libs\http_socket.php, line 133] Context | Code $uri = "://localhosthttp://maps.google.com/maps/geo? &q=1600%20Pennsylvania%20Ave.%20Washington%20DC %20USA&output=csv&key=ABQIAAAAn0kmVahg_WhO0jCT8Z8MkBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS- Zl837z60cpTjKeSeelhEJVmNOQ" // If we were not given an array as $uri if (!is_array($uri)) { // Parse the $uri string into an array using php's parse_url function $uri = parse_url($uri); } parse_url - [internal], line ?? HttpSocket::setURI() - CORE\cake\libs\http_socket.php, line 133 HttpSocket::request() - CORE\cake\libs\http_socket.php, line 268 HttpSocket::get() - CORE\cake\libs\http_socket.php, line 320 GeocodedBehavior::_geocoords() - CORE\app\models\behaviors \geocoded.php, line 113 GeocodedBehavior::geocode() - CORE\app\models\behaviors\geocoded.php, line 87 Model::call__() - CORE\cake\libs\model\model.php, line 477 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 46 Location::geocode() - [internal], line ?? LocationsController::index() - CORE\app\controllers \locations_controller.php, line 16 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323 [main] - CORE\app\webroot\index.php, line 83 Notice (8): Undefined index: scheme [CORE\cake\libs\http_socket.php, line 230] Context | Code $uri = array("persistent" => false, "host" => "localhost", "port" => 80, "login" => null, "password" => null, "timeout" => 30, "query" => false, "path" => "") $uriTemplate = "/%path" $defaultPorts = array("http" => 80, "https" => 443) $defaultPorts = array('http' => 80, 'https' => 443); // If our $uri uses the default port for it's scheme if ($defaultPorts[$uri['scheme']] == $uri['port']) { // Strip the port part from the $uriTemplate HttpSocket::getURI() - CORE\cake\libs\http_socket.php, line 230 HttpSocket::__buildHeader() - CORE\cake\libs\http_socket.php, line 401 HttpSocket::buildHeader() - CORE\cake\libs\http_socket.php, line 378 HttpSocket::request() - CORE\cake\libs\http_socket.php, line 287 HttpSocket::get() - CORE\cake\libs\http_socket.php, line 320 GeocodedBehavior::_geocoords() - CORE\app\models\behaviors \geocoded.php, line 113 GeocodedBehavior::geocode() - CORE\app\models\behaviors\geocoded.php, line 87 Model::call__() - CORE\cake\libs\model\model.php, line 477 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 46 Location::geocode() - [internal], line ?? LocationsController::index() - CORE\app\controllers \locations_controller.php, line 16 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323 [main] - CORE\app\webroot\index.php, line 83 Notice (8): Undefined index: [CORE\cake\libs\http_socket.php, line 230] Context | Code $uri = array("persistent" => false, "host" => "localhost", "port" => 80, "login" => null, "password" => null, "timeout" => 30, "query" => false, "path" => "") $uriTemplate = "/%path" $defaultPorts = array("http" => 80, "https" => 443) $defaultPorts = array('http' => 80, 'https' => 443); // If our $uri uses the default port for it's scheme if ($defaultPorts[$uri['scheme']] == $uri['port']) { // Strip the port part from the $uriTemplate HttpSocket::getURI() - CORE\cake\libs\http_socket.php, line 230 HttpSocket::__buildHeader() - CORE\cake\libs\http_socket.php, line 401 HttpSocket::buildHeader() - CORE\cake\libs\http_socket.php, line 378 HttpSocket::request() - CORE\cake\libs\http_socket.php, line 287 HttpSocket::get() - CORE\cake\libs\http_socket.php, line 320 GeocodedBehavior::_geocoords() - CORE\app\models\behaviors \geocoded.php, line 113 GeocodedBehavior::geocode() - CORE\app\models\behaviors\geocoded.php, line 87 Model::call__() - CORE\cake\libs\model\model.php, line 477 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 46 Location::geocode() - [internal], line ?? LocationsController::index() - CORE\app\controllers \locations_controller.php, line 16 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323 [main] - CORE\app\webroot\index.php, line 83 Warning (2): preg_match() expects parameter 2 to be string, array given [CORE\app\models\behaviors\geocoded.php, line 114] Context | Code $model = Location object $address = "1600 Pennsylvania Ave. Washington DC USA" $lookup = "google" $key = "ABQIAAAAn0kmVahg_WhO0jCT8Z8MkBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS- Zl837z60cpTjKeSeelhEJVmNOQ" $cacheTable = "geocodes" $fields = array(0 => "lat", 1 => "lon") $url = "http://maps.google.com/maps/geo?&q=1600%20Pennsylvania%20Ave. %20Washington%20DC %20USA&output=csv&key=ABQIAAAAn0kmVahg_WhO0jCT8Z8MkBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS- Zl837z60cpTjKeSeelhEJVmNOQ" $code = false $result = array(0 => "HTTP/1.1 403 Forbidden Date: Tue, 03 Jul 2007 19:59:59 GMT Server: Apache/2.2.4 (Win32) PHP/5.2.3 Content-Length: 202 Connection: close Content-Type: text/html; charset=iso-8859-1 Forbidden You don't have permission to access / on this server. ") $match = null $code = false; if($result = $this->connection->get($url)) { if (preg_match($this->lookupServices[low($lookup)][1], $result, $match)) { $code = array($fields[0] => floatval($match[1]), $fields[1] => floatval($match[2])); preg_match - [internal], line ?? GeocodedBehavior::_geocoords() - CORE\app\models\behaviors \geocoded.php, line 114 GeocodedBehavior::geocode() - CORE\app\models\behaviors\geocoded.php, line 87 Model::call__() - CORE\cake\libs\model\model.php, line 477 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 46 Location::geocode() - [internal], line ?? LocationsController::index() - CORE\app\controllers \locations_controller.php, line 16 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323 [main] - CORE\app\webroot\index.php, line 83 Warning (2): array_reverse() [function.array-reverse]: The argument should be an array [CORE\app\models\behaviors\geocoded.php, line 94] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
