How to get weather and weather information?


I came across a problem I'd like to see if it can be solved in a similar way to the mail . When you have a zip you can retrieve from a web service other data, such as the address and city of this zip informed.

In terms of climate, is there any way to get the weather information, temperature and current temperature of that place (the intention was then to stylise the css of this part of the page to make it look nice) ?

asked by anonymous 08.03.2016 / 20:56

6 answers


You can get this information through weather service APIs such as Yahoo!

I've created and tested an example usage, as shown below:

    var callbackFunction = function(data) {

<script src="*fromweather.forecastwherewoeidin(selectwoeidfromgeo.places(1)wheretext='sãopaulo,sp')&format=json&callback=callbackFunction"></script>


  • format : it is the type of data that will be returned, being JSON or XML;
  • callback : this is the function that will handle the response of your request.

You can also add

and u = 'c'

in the WHERE clause to change to the metric system and scale to Celsius.

If it's just a city, you can search the WOEID before to improve the response time.

For example, for São Paulo,


I would return 455827, where the final query would be:

select * from weather.forecast where woeid = 455827&format=json&callback=callbackFunction

There is this site , own Yahoo !, where you can test your YQL (Yahoo Query Language).

It is worth mentioning that according to the Yahoo API, the limit of daily queries is 2 thousand requisitions, and pay attention to the terms of use, where it can only be used by individuals, non-profit companies and non-commercial use.

Remember that the Yahoo! API is only one of the solutions, if it does not meet your needs, you can search for 'weather api' or 'weather api' forecast.

08.03.2016 / 21:13

I found this 'API' which returns the following data:

 "cidade":"Sao Paulo - SP",
  "data_hora":"08\/11\/2013 - 19:59",
  "descricao":"Muito Nublado (noite)",
  "visibilidade":"9,99 km",
  "vento_velocidade":"20,92 km\/h",
  "pressao":"1.015,92 mBar",
  "nascer_do_sol":"6:16 am",
  "por_do_sol":"7:25 pm",
   "data":"Sexta - 08\/11\/2013",
   "descricao":"Parcialmente Nublado (noite)",
   "data":"S\u00e1bado - 09\/11\/2013",
   "descricao":"Tempo Bom (dia)",
   "data":"Domingo - 10\/11\/2013",
   "data":"Segunda - 11\/11\/2013",
   "descricao":"Parcialmente Nublado (dia)",
   "data":"Ter\u00e7a - 12\/11\/2013",
   "descricao":"Parcialmente Nublado (dia)",

Follow the url: link

I tested the request described in the documentation, with Angularjs, and returned everything correctly. =)

08.03.2016 / 21:19

Climatempo (Brazilian meteorological company) launched an API in 2017, you can preach the forecast for free.

The site is link

There you have all the documentation. Just log in with your "Facebook", "Google" or "Github", generate a token and make the request via GET.

16.01.2018 / 13:39

If it is via programming with C # I recommend using the Html Agility Pack, with it you can tell the source of the information (Site) and inform the code in which div is the information you want to be able to use for various purposes, I used it to get the mega-results.


09.03.2016 / 04:35

A JSON alternative is: link

Just change the city name followed by the state. Take accents, example:

12.07.2016 / 17:28

Based on the answer from silvalexandre
Use the link above to find out the location woeid

    select woeid from geo.places(1) where text='são paulo, sp'

Javascript Call lib jquery and

        q:'select * from weather.forecast where woeid in (455822)',
    },function (res) {
            umi =;
            temp =;

            temp = Math.round((temp-32)/1.8); //F to C



$cont = file_get_contents("*%20from%20weather.forecast%20where%20woeid%20in%20(455822)&format=json");

$cont = json_decode($cont,1);

$umi = $cont['query']['results']['channel']['atmosphere']['humidity'];
$temp = $cont['query']['results']['channel']['item']['condition']['temp'];

$temp = intval( ($temp - 32) /1.8 ); //F to C

echo $umi." ".$temp;
20.06.2017 / 16:54