I want to learn and to understand how can i use data, sent from an external server into my laravel project.
So i made this route :
Route::get('/receive','MyController@Receive');
And in Controller i did that :
public function Receive(Request $request){
$data = file_get_contents("php://input");
$json_dat = json_decode($data, true);
echo $json_dat;
}
Using POSTMAN, i sent i POST request to `http://my_domain/receive
With Body > Row > JSON APP And a simple table like that : `
[{
"type_3": "Hero",
}]
When executing the URL in Postman, nothing happens in echo $json_dat
What I'm expecting is : Json data with type_3 : Hero
Thank you in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire