[英]Retrieving POST request from outer application to Laravel: 419 unknown status
I am trying to send POST request from advanced REST client for Chrome to Laravel App: 我正在尝试从Chrome的高级REST客户端向laravel应用发送POST请求:
I understand that Laravel has the protection from request like it, but what I need, for example, to update the database from some native application, like UWP? 我知道Laravel可以防止此类请求,但是例如,需要从某些本地应用程序(如UWP)更新数据库,我需要什么呢? (Of course, I use advanced REST client for testing for now).
(当然,我现在使用高级REST客户端进行测试)。
I tried Laravel JSON API . 我尝试了Laravel JSON API 。 With below code, I retrieve error 419 unknown status (also,
dump('done')
has not been reached: 使用以下代码,我检索到错误419未知状态 (也尚未达到
dump('done')
:
Route::post('api/update', function(){
dump('done');
$guzzleClient = new GuzzleHttp\Client(['base_uri' => 'http://example.loc/api/update/']);
$client = json_api('v1')->client($guzzleClient);
});
What I missed? 我错过了什么? Please let me know WHERE I need to add code from your solution (controller, web.php etc.).
请让我知道我需要在您的解决方案中添加代码(控制器, web.php等)。
write in your api.php 用你的api.php写
Route::get('/update',function(){
return response()->json("test");
});
and check with same url in rest client http://example.loc/api/update/ and see result 并在其余客户端http://example.loc/api/update/中使用相同的URL检查并查看结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.