Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel api response json

return response()->json($array);
Comment

API json data show in laravel

$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
}
Comment

API json data show in laravel

<?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}
";

foreach($parsed_json['forecast']['forecastday[0]'] as $key => $value)
{
   echo $value['period'];
   echo $value['icon'];
   // etc
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel run function after forgot password 
Php :: php page sends cookie to visitor 
Php :: serialize php 
Php :: create xml php 
Php :: laravel default rate limit 
Php :: laravel set middleware default 
Php :: blocked token vs expired token 
Php :: iterator 
Php :: create symfony project 
Php :: phpexcel 
Php :: laravel debugbar not showing 
Php :: optional route parameter in laravel 
Php :: In PackageManifest.php line 131: Undefined index: name 
Php :: woocommerce_rest_cannot_view 
Php :: laravel dynamically add remove table row 
Php :: storefront product search 
Php :: php run server laravel 
Php :: how get end of array in foreach php 
Php :: upload laravel 
Php :: RouteSubscriber disallow user routes 
Php :: how to use php in a project on localhost 
Php :: Laravel You may determine if a template inheritance section has content using the @hasSection directive: 
Php :: static functions php 
Php :: markdown mail html rendering laravel 
Php :: Uncaught TypeError: call_user_func(): Argument #1 
Php :: whats is typecasting in php 
Php :: command ui is not found 
Php :: php curl fail verbosly 
Php :: selecting values from database 
Php :: php notice: trying to access array offset on value of type bool in /usr/share/php/pear/rest.php on line 187 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =