Jump to content

tetah31

Members
  • Posts

    1
  • Joined

  • Last visited

tetah31's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. tetah31

    from api to php

    good evening, i'm trying to get info from openweathermap to my own site i only know html - css and a little php. php say that the first line <?php $url = .... ?> have a error i d'ont undestand the problem. here is my code that i use for getting this information : <aside> <?php $url = https://api.openweathermap.org/data/2.5/find?q=Veurne&units=metric&type=accurate&mode=xml&APPID=my own id; $getweather = simplexml_load_file ($url); ?> <?php $gethumidity = $getweather->list->item->humidity('value'); ?> <?php $gettemp = $getweather->list->item->temperature('value'); ?> <?php $feelslike = $getweather->list->item->feels_like('value'); ?> <?php $speed = $getweather->list->item->speed('value'); ?> <?php $direction = $getweather->list->item->direction('code'); ?> <h3>info</h3> <h4>weather</h4> <ul> <li>Temperature: <?php echo($gettemp); ?> &deg;C</li> <li>feels like: <?php echo($feelslike); ?> &deg;C</li> <li>wind speed: <?php echo($speed); ?> m/s</li> <li>wind direction: <?php echo($direction); ?></li> <li>humidity: <?php echo($gethumidity); ?> %</li> </ul> </aside>
×
×
  • Create New...