[horde] Horde WX Block WorldWeatherOnline Update

Andy Dorman adorman at ironicdesign.com
Thu May 23 22:01:38 UTC 2013


We have made a little progress, but have reached a point where our 
unfamiliarity with PHP and the new Horde (we have been working with the 
new code about a day now) is stopping us.

Again, we are working with Horde 5.04 (latest debian package)

What we have found...

WorldWeatherOnline is changing their API access calls as described here.

https://www.facebook.com/notes/world-weather-online/introducing-faster-more-efficient-and-even-more-reliable-services/451128854963809

The minor changes in Horde/Service/Weather/Wwo.php in the diff below 
will create an http request that works just fine with their new API, but 
only if you paste the resulting http string manually into a browser.

24,25c24,25
<     const API_URL = 
'http://free.worldweatheronline.com/feed/weather.ashx';
<     const SEARCH_URL = 
'http://www.worldweatheronline.com/feed/search.ashx';
---
>     const API_URL = 'http://api.worldweatheronline.com/free/v1/weather.ashx';
>     const SEARCH_URL = 'http://api.worldweatheronline.com/free/v1/search.ashx';
142c142
<             'query' => $search,
---
>             'q' => $search,
295c295
<             'query' => $location,
---
>             'q' => $location,

For example, this string works (with a valid wwo free key)
http://api.worldweatheronline.com/free/v1/search.ashx?timezone=yes&q=huntsville%2CAL&num_of_results=10&format=json&key=xxxxxxxxxxxxxxxxxxxxxxxx

However, when I look at $response from line 337 of 
Horde/Service/Weather/Wwo.php

   $response = $this->_http->get($url);

with print_r, this is what we see.

Horde_Http_Response_Fopen Object
(
     [_stream:protected] => Resource id #273
     [_content:protected] =>
     [uri] => Horde_Url Object
         (
             [url] => http://api.worldweatheronline.com/free/v1/search.ashx
             [raw] => 1
             [parameters] => Array
                 (
                     [q] => huntsville,AL
                     [timezone] => yes
                     [num_of_results] => 10
                     [format] => json
                     [key] => xxxxxxxxxxxxxxxxxxxxxxxxx
                 )

             [pathInfo] =>
             [anchor] =>
             [toStringCallback] =>
         )

     [httpVersion] => 1.1
     [code] => 417
     [headers] => Array
         (
             [content-length] => 0
             [connection] => Close
         )

)

and of course line 342,

   $results = $response->getBody();

returns nothing.

We started digging into $this->_http and our newness with PHP quickly 
caught up with us.

So we are hoping the above information will enable one of the other very 
smart Horde developers to more easily figure out what is going on.

-- 
Andy Dorman
FanMail.com
Ironic Design, Inc.
AnteSpam.com, HomeFreeMail.com, ComeHome.net

CONFIDENTIALITY NOTICE: This message is for the named person's use only. 
It may contain confidential, proprietary or legally privileged 
information. No confidentiality or privilege is waived or lost by any 
erroneous transmission. If you receive this message in error, please 
immediately destroy it and notify the sender. You must not, directly or 
indirectly, use, disclose, distribute, or copy any part of this message 
if you are not the intended recipient.



More information about the horde mailing list