cvs: pear /Services_Weather/Weather Weatherdotcom.php

From: Date: Wed, 12 Oct 2005 16:11:54 +0000
Subject: cvs: pear /Services_Weather/Weather Weatherdotcom.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35454@lists.php.net to get a copy of this message
eru Wed Oct 12 12:11:54 2005 EDT Modified files: /pear/Services_Weather/Weather Weatherdotcom.php Log: Changed searching for location to incorporate HTTP_Request, so that we can use a timeout http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Weatherdotcom.php?r1=1.44&r2=1.45&ty=u Index: pear/Services_Weather/Weather/Weatherdotcom.php diff -u pear/Services_Weather/Weather/Weatherdotcom.php:1.44 pear/Services_Weather/Weather/Weatherdotcom.php:1.45 --- pear/Services_Weather/Weather/Weatherdotcom.php:1.44 Thu Jul 21 03:48:36 2005 +++ pear/Services_Weather/Weather/Weatherdotcom.php Wed Oct 12 12:11:51 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Weatherdotcom.php,v 1.44 2005/07/21 07:48:36 eru Exp $ +// $Id: Weatherdotcom.php,v 1.45 2005/10/12 16:11:51 eru Exp $ /** * @package Services_Weather @@ -199,7 +199,7 @@ return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA, __FILE__, __LINE__); } $data = $request->getResponseBody(); - + // ...and unserialize $status = $this->_unserializer->unserialize($data); @@ -266,8 +266,15 @@ function searchLocation($location, $useFirst = false) { // Get search data from server and unserialize - $searchURL = "http://xoap.weather.com/search/search?where=".urlencode(trim($location)); - $status = $this->_unserializer->unserialize($searchURL, true, array("overrideOptions" => true, "complexType" => "array", "keyAttribute" => "id")); + $request = &new HTTP_Request("http://xoap.weather.com/search/search?where=".urlencode(trim($location)), array("timeout" => $this->_httpTimeout)); + $status = $request->sendRequest(); + if (Services_Weather::isError($status)) { + return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA, __FILE__, __LINE__); + } + $data = $request->getResponseBody(); + + // ...and unserialize + $status = $this->_unserializer->unserialize($data, false, array("overrideOptions" => true, "complexType" => "array", "keyAttribute" => "id")); if (Services_Weather::isError($status)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA, __FILE__, __LINE__);

« previous php.pear.cvs (#35454) next »