Re: cvs: pear /Services_Weather/Weather Metar.php Weatherdotcom.php
| From: | Hannes Magnusson | Date: | Wed, 16 Nov 2005 20:59:15 +0000 |
| Subject: | Re: cvs: pear /Services_Weather/Weather Metar.php Weatherdotcom.php | ||
| References: | 1 | Groups: | php.pear.cvs |
| Request: | Send a blank email to pear-cvs+get-36335@lists.php.net to get a copy of this message | ||
Should you rather check for status 200?
For instance, 204 (No content), 202 (Accepted) and 100 (Continue) don't send
any data other then the headers...
On 11/16/05, Alexander Wirtz <eru@php.net> wrote:
>
> eru Wed Nov 16 15:12:08 2005 EDT
>
> Modified files:
> /pear/Services_Weather/Weather Metar.php Weatherdotcom.php
> Log:
> o Check for return code of HTTP request
>
>
>
> http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Metar.php?r1=1.82&r2=1.83&ty=u
> Index: pear/Services_Weather/Weather/Metar.php
> diff -u pear/Services_Weather/Weather/Metar.php:1.82pear/Services_Weather/Weather/Metar.php:
> 1.83
> --- pear/Services_Weather/Weather/Metar.php:1.82 Sun Nov 13 17:44:47 2005
> +++ pear/Services_Weather/Weather/Metar.php Wed Nov 16 15:12:01 2005
> @@ -40,7 +40,7 @@
> * @author Alexander Wirtz <alex@pc4p.net>
> * @copyright 2005 Alexander Wirtz
> * @license http://www.opensource.org/licenses/bsd-license.php
> BSD License
> - * @version CVS: $Id: Metar.php,v 1.82 2005/11/13 22:44:47 eru Exp $
> + * @version CVS: $Id: Metar.php,v 1.83 2005/11/16 20:12:01 eru Exp $
> * @link http://pear.php.net/package/Services_Weather
> * @link http://weather.noaa.gov/weather/metar.shtml
> * @link http://weather.noaa.gov/weather/taf.shtml
> @@ -355,7 +355,7 @@
>
> $request = &new
>
> HTTP_Request($this->{"_sourcePath".ucfirst($dataType)}."/".$id.".TXT",
> $this->_httpOptions);
> $status = $request->sendRequest();
> - if (Services_Weather::isError($status)) {
> + if (Services_Weather::isError($status) || (int)
> $request->getResponseCode() >= 400) {
> return
> Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA,
> __FILE__, __LINE__);
> }
>
>
> °¼{µ…q« cÛ
> é"PP–http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Weatherdotcom.php?r1=1.56&r2=1.57&ty=u
> Index: pear/Services_Weather/Weather/Weatherdotcom.php
> diff -u
> pear/Services_Weather/Weather/Weatherdotcom.php:1.56pear/Services_Weather/Weather/Weatherdotcom.php:
> 1.57
> --- pear/Services_Weather/Weather/Weatherdotcom.php:1.56 Wed Nov 16
> 07:48:32 2005
> +++ pear/Services_Weather/Weather/Weatherdotcom.php Wed Nov 16 15:12:03
> 2005
> @@ -40,7 +40,7 @@
> * @author Alexander Wirtz <alex@pc4p.net>
> * @copyright 2005 Alexander Wirtz
> * @license http://www.opensource.org/licenses/bsd-license.php
> BSD License
> - * @version CVS: $Id: Weatherdotcom.php,v 1.56 2005/11/16 12:48:32 eru
> Exp $
> + * @version CVS: $Id: Weatherdotcom.php,v 1.57 2005/11/16 20:12:03 eru
> Exp $
> * @link http://pear.php.net/package/Services_Weather
> * @link http://www.weather.com/services/xmloap.html
> * @example examples/weather.com-basic.php weather.com-basic.php
> @@ -265,7 +265,7 @@
> // Get data from URL...
> $request = &new HTTP_Request($url, $this->_httpOptions);
> $status = $request->sendRequest();
> - if (Services_Weather::isError($status)) {
> + if (Services_Weather::isError($status) || (int)
> $request->getResponseCode() >= 400) {
> return
> Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA,
> __FILE__, __LINE__);
> }
> $data = $request->getResponseBody();
> @@ -345,7 +345,7 @@
> // Get search data from server and unserialize
> $request = &new HTTP_Request("
>
> http://xoap.weather.com/search/search?where=".urlencode($location),
> $this->_httpOptions);
> $status = $request->sendRequest();
> - if (Services_Weather::isError($status)) {
> + if (Services_Weather::isError($status) || (int)
> $request->getResponseCode() >= 400) {
> return
> Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA,
> __FILE__, __LINE__);
> }
> $data = $request->getResponseBody();
>
> --
> PEAR CVS Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>