function tide_lh(){$htm='';$curl=curl_init();curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?station=8535163&product=predictions&datum=MLLW&time_zone=lst_ldt&interval=hilo&units=english&application=DataAPI_Sample&format=json&date=today',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'GET',));$response=curl_exec($curl);curl_close($curl);$json_decode=json_decode($response);$morning_low_time=$json_decode->predictions[0]->t;$morning_low_time=explode(' ',$morning_low_time);$morning_low_time=date("g:i a",strtotime($morning_low_time[1].":00 UTC"));$morning_low_value=$json_decode->predictions[0]->v;$morning_low_value=round($morning_low_value,2).' ft';$morning_high_time=$json_decode->predictions[1]->t;$morning_high_time=explode(' ',$morning_high_time);$morning_high_time=date("g:i a",strtotime($morning_high_time[1].":00 UTC"));$morning_high_value=$json_decode->predictions[1]->v;$morning_high_value=round($morning_high_value,2).' ft';$evening_low_time=$json_decode->predictions[2]->t;$evening_low_time=explode(' ',$evening_low_time);$evening_low_time=date("g:i a",strtotime($evening_low_time[1].":00 UTC"));$evening_low_value=$json_decode->predictions[2]->v;$evening_low_value=round($evening_low_value,2).' ft';$evening_high_time=$json_decode->predictions[3]->t;$evening_high_time=explode(' ',$evening_high_time);$evening_high_time=date("g:i a",strtotime($evening_high_time[1].":00 UTC"));$evening_high_value=$json_decode->predictions[3]->v;$evening_high_value=round($evening_high_value,2).' ft';$curl2=curl_init();curl_setopt_array($curl2,array(CURLOPT_URL=>'https://api.openweathermap.org/data/2.5/weather?lat=39.194012&lon=-74.659607&appid=3b5c07495d9103b4e303933e6379c8df',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'GET',));$response2=curl_exec($curl2);curl_close($curl2);$json_decode2=json_decode($response2);$humidity=$json_decode2->main->humidity."&deg;";$speed=$json_decode2->wind->speed;$speed=round($speed,2).'mph';$sunrise=$json_decode2->sys->sunrise;$sunset=$json_decode2->sys->sunset;$date_sunrise=date("g:i a",$sunrise);$date_sunset=date("g:i a",$sunset);$morning_low_timestamp=strtotime($morning_low_time);$morning_high_timestamp=strtotime($morning_high_time);$evening_low_timestamp=strtotime($evening_low_time);$evening_high_timestamp=strtotime($evening_high_time);$cur_time=time();if($cur_time>=$morning_low_timestamp && $cur_time < $evening_low_timestamp){$htm .='<div class="main_lh"><div class="inner_lh"><p>map<br>Strathmere, NJ</p></div><div class="inner_lh"><p>current weather<br><strong>'.$humidity.'</strong></p></div><div class="inner_lh"><p>current wind speed<br><strong>'.$speed.'</strong></p></div><div class="inner_lh"><p>sunset time<br><strong>'.$date_sunset.'</strong></p></div><div class="inner_lh"><p>next low tide<br><strong>'.$evening_low_time.' - '.$evening_low_value.'</strong></p></div><div class="inner_lh"><p>next high tide<br><strong>'.$evening_high_time.' - '.$evening_high_value.'</strong></p></div></div>'}else{$htm .='<div class="main_lh"><div class="inner_lh"><p>map<br>Strathmere, NJ</p></div><div class="inner_lh"><p>current weather<br><strong>'.$humidity.'</strong></p></div><div class="inner_lh"><p>current wind speed<br><strong>'.$speed.'</strong></p></div><div class="inner_lh"><p>sunrise time<br><strong>'.$date_sunrise.'</strong></p></div><div class="inner_lh"><p>next low tide<br><strong>'.$morning_low_time.' - '.$morning_low_value.'</strong></p></div><div class="inner_lh"><p>next high tide<br><strong>'.$morning_high_time.' - '.$morning_high_value.'</strong></p></div></div>'}$htm .='<style>.main_lh{display:flex; align-items:center;}.inner_lh{width:100%;}</style>';return $htm}add_shortcode('tide_lh','tide_lh');