Select Page

This is a PHP website that connects to Dark sky API to get current weather conditions and a 5-day weather forecast and display it as a responsive web page. it uses the IP address sent to the web server as a request which is then sent to Ip loc API which sent back the latitude and longitude(20-30 km accuracy) of the Requester.

The libraries and API used in this project were:

Link to Github repo

array(337.5, 22.5),
‘NE’ => array(22.5, 67.5),
‘E’ => array(67.5, 112.5),
‘SE’ => array(112.5, 157.5),
‘S’ => array(157.5, 202.5),
‘SW’ => array(202.5, 247.5),
‘W’ => array(247.5, 292.5),
‘NW’ => array(292.5, 337.5)
);
// for statement to convert degree to wind direction eg west
foreach ($cardinalDirections as $dir => $angles) { // convert degrees into wind direction => is separator, key value pair
if ($bearing >= $angles[0] && $bearing < $angles[1]) { // if bearing greater than/equal and less than , // then set direction to = dir $direction = $dir; break; } } return $direction; } $direction = degreeToString($bearing); // calls the degree to string function //Daily Forecast $dailySummary = $resultsDark['daily']['summary']; $dailyIcon = $resultsDark['daily']['icon']; $dailyCond = array(); foreach ($resultsDark['daily']['data'] as $d) { // for loop through array to find Key daily and value data, // set that as a new array dailycond $dailyCond[] = $d; } foreach ($dailyCond as $cond) { $wTempHigh = round($cond['temperatureMax']); $wTempLow = round($cond['temperatureMin']); $wTime = $cond['time']; $wIcon = $cond['icon']; }[/php][/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]