Question : laravel api response json
Answered by : revaz-gh
return response()->json($array);
Source : | Last Update : Mon, 24 May 21
Question : API json data show in laravel
Answered by : different-dog-pt1bgfgo7yfx
$json_string = file_get_contents("http://api.wunderground.com/api/7ec5f6510a4656df/geolookup/forecast/q/40121.json");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['forecast']['txt_forecast']['forecastday'];
//pr($parsed_json);
foreach($parsed_json as $key => $value)
{ echo $value['period'] . '<br>'; echo $value['icon'] . '<br>'; // etc
}
Source : https://stackoverflow.com/questions/10967770/displaying-json-data-with-php | Last Update : Fri, 25 Feb 22
Question : API json data show in laravel
Answered by : different-dog-pt1bgfgo7yfx
<?php
$json_string = file_get_contents("http://api.wunderground.com/api/7ec5f6510a4656df/geolookup/forecast/q/40121.json");
$parsed_json = json_decode($json_string);
$temp = $parsed_json->{'forecast'}->{'txt_forecast'}->{'date'};
$title = $parsed_json->{'forecast'}->{'txt_forecast'}->{'forecastday'}->{'title'};
$for = $parsed_json->{'forecast'}->{'txt_forecast'}->{'forecastday'}->{'fcttext'};
echo "Current date is ${temp}, ${title}: ${for}\n";
foreach($parsed_json['forecast']['forecastday[0]'] as $key => $value)
{ echo $value['period']; echo $value['icon']; // etc
}
?>
Source : https://stackoverflow.com/questions/10967770/displaying-json-data-with-php | Last Update : Fri, 25 Feb 22