I'm trying to POST data using command line using curl.
curl -v POST -d ' { "data1": "sample1", "data2": "sample2" } ' -H "Content-Type: application/json" -H "Authorization: BASIC vkslnkg561mZEqCq3l3RglAOAZ7d8XBeg2VjIAyC" http://localhost/Bowling/public/api/foo
When I try to POST from POSTMAN, I get the data back. But when I use curl, I'm getting a 500 Internal Server Error.
My routes.php
Route::any('api/foo', function () {
return json_encode("Some Data");
});
May I know is it something wrong with my curl statement or some authentication problem that I need to fix in Laravel.
I even tried with
curl -X POST -H "Content-Type: application/json" -d '{"key":"val"}' -H "Authorization: BASIC 0xD8BC2CLksEMh1ScRdG8dWanCDazYiQsGL7sYnl" http://localhost/Bowling/public/api/foo