Climatempo to include in the site

3

Would anyone know if I could find an xml or some script to insert the weather forecast for the beach tabua de tides on my site?

I need something like this from this site:

link

Could you give me a help?

    
asked by anonymous 24.06.2015 / 13:55

2 answers

3

The CPTEC website has some services in xml. link

    
25.08.2015 / 04:13
1

I use a PHP code that connects to the link API, and step as parameters to the city in my case Araci-Bahia, the measure and the language, it returns a JSON after this is only you treat the JSON.

In my case I call this PHP via Ajax, there I do all the processing, iteration, etc.

function get_weather(){
 try{
    $obj = file_get_contents("http://api.openweathermap.org/data/2.5/weather?q=araci,brasil&lang=pt&units=metric");
    $item = json_decode($obj);
    //no meu caso dou a saída para o AJAX onde trato
    return round($item->main->temp);
 }catch(Exception $ex){
       //trata o erro
 }
}
    
25.08.2015 / 04:34