Simple and straight.
<?php
ini_set('display_errors', 1);
$json = file_get_contents("https://api.sunrise-sunset.org/json?lat=51.507351&lng=-0.127758&date=today");
$array=json_decode($json,true);
echo $SunRiseTime=$array["results"]["sunrise"];
echo $SunSetTime=$array["results"]["sunset"];
Output: 4:21:35 AM
7:32:34 PM
3
solved decode json into php variables [duplicate]