Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Inconsistent response when using wb_forecast #2

@GoogleCodeExporter

Description

@GoogleCodeExporter
This is a carry over from the Google Groups.

When I use the Function "wb_forecast"  the wrapper  does not seem to
return the values for the following:
  $forecast['webURL'] ,  $forecast['type'] ,    $forecast['date'],
$forecast['location']['city'], $forecast['location']['state'],
$forecast['location']['zipcode'] and $forecast['location']['zone'].

They all come back blank although they are present in the feed.  Am I
missing something? 

---

I have since found the solution.  The feed sent by a zip request is different
to that sent by a citycode or a lat/long request so the pre_match statement in 
the function
"wb_forecast" had to be changed from:

ZIP
preg_match("/<aws:WebURL>(.*?)<\/aws:WebURL><aws:forecasts 
type=\"(.*?)\"date=\"(.*?)\"
><aws:location><aws:city>(.*?)<\/aws:city><aws:state>(.*?)<\/aws:state><aws:zip>
([0-9]

*?)<\/aws:zip><aws:zone>(.*?)<\/aws:zone><\/aws:location>/", $file, $results);

to:

CITYCODE
preg_match("/<aws:WebURL>(.*?)<\/aws:WebURL><aws:forecasts type=\"(.*?)\" 
date=\"(.*?)\"
><aws:location><aws:city>(.*?)<\/aws:city><aws:citycode>([0-9]*?)<\/aws:citycode
><aws:

country>(.*?)<\/aws:country><\/aws:location>/", $file, $results);

I’m no programmer so I was pleased to be able find a fix.

I guess the code should check for the type of request and then use the 
appropriate preg_match
statement so it covers all possibilities. 


Original issue reported on code.google.com by [email protected] on 3 Apr 2011 at 8:52

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions