Location code works only for us
| Project: | WeatherFacti -- from a weather.com xml feed |
| Version: | 6.x-1.9 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | gkapog |
| Status: | active |
Jump to:
In your code from IP you get the city only. The api.hostip.info returns and the country an the output is like this:
Country: GREECE (GR)
City: Athens
Location code from IP works only for US because the line:
$result = _get_url("http://ws.geonames.org/postalCodeSearch?maxRows=1&placename=".$city);
returns the first postal code it finds. If you have "Athens" for the city, Athens, OH is found, the zip code is placed in weather.com and you get the weather of Athens, OH, US and not the weather of Athens, Greece.
I try to put the url
http://ws.geonames.org/postalCodeSearch?maxRows=1&placename=athens&count...
you get the right city but wrong location code for weather map. The location code for other countries is not the zip code. In my example the location code is "GRXX0004" while the zip code is 10431.
One way to get around the problem is to use the url
http://xoap.weather.com/search/search?where=[commonidentifier] in my case:
http://xoap.weather.com/search/search?where=Athens,Greece
and it displays correctly the location code "GRXX0004".
If you use the same code for a US ciry you must put the state:
http://xoap.weather.com/search/search?where=Athens,OH.
State OH is returned by the ws.geonames.org under the label
I hope you will make the changes in your code in order to select the correct city from the IP of the client.

#1
and something I forgot, it does not support utf8 chars to display in block...
I think it has to do with the database encoding
#2
Are you familiar with CVS and committing changes?