If php / pdo can lumen can. Lumen is a php framework.
http://stackoverflow.com/questions/18354638/json-post-and-decode-array-to-php
If the json is not formatted correctly it will just silently fail to parse it
Thanks for the replies! I got it working now.
The answer I was looking for was to use the Request::json()->get method, to extract the JSON data from the request.
So, posting a request like this...
POST / HTTP/1.1
Host: localhost
Content-Type: application/json
{
"name": "dave"
}
...and accessing the data using something like...
$app->post('/', function() use ($app) {
dd(Request::json()->get('name'));
});
Maybe useful for someone else. Thanks!
I wrote about this topic - "How to Submit a JSON POST Request in Lumen" - https://medium.com/@paulredmond/how-to-submit-json-post-requests-to-lumen-666257fe8280
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community