Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel json response

return response()->json([
    'name' => 'Abigail',
    'state' => 'CA',
]);
Comment

Laravel json response

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

laravel json response

Route::get('/status', function () {
    return response(["success" => true])->header('Content-Type', 'application/json');
});
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 :: php pdo error handling 
Php :: convert string to float in php 
Php :: symfony get path to route 
Php :: how to get shop page url in wordpress 
Php :: base url dinamis codeigniter 
Php :: php rotate image 
Php :: wordpress get id from page title 
Php :: Warning: sprintf(): Too few arguments in /opt/lampp/htdocs/wordpress/wp-admin/includes/class-bulk-upgrader-skin.php on line 152 
Php :: php geolocation package 
Php :: laravel insert array 
Php :: laravel @extends 
Php :: wordpress add meta user 
Php :: remove gutenberg cpt 
Php :: drupal 9 modify a views query 
Php :: Laravel eloquent restore soft delete 
Php :: laravel route multiple methods 
Php :: wordpress theme development boilerplate 
Php :: how to remove array index from json in php 
Php :: json_deocde 
Php :: install php apache 
Php :: adminlte 3 laravel 
Php :: laravel get column field name 
Php :: foreach date php 
Php :: withdefault laravel 
Php :: laravel merge two query builder 
Php :: where condition in array in codeigniter 
Php :: min function in php 
Php :: TRANSACTON LARAVEL QUERY BUILDER 
Php :: generate random string in php 
Php :: factory laravel laravel 8 tinker 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =