![](/img/trans.png)
[英]In Laravel, how do I make a guzzle http post request with csrf token
[英]Why do I get a 301 response on HTTP post to Laravel without CSRF token?
我正在嘗試在我的網店中設置 Adyen 通知。
https://docs.adyen.com/development-resources/notifications/understand-notifications
當我使用 Adyen 測試頁面測試 HTTP 帖子時,我得到 301 響應,但是當我使用自定義表單測試 HTTP 帖子時,路由有效。
web.php 中的路由:
Route::name('shop.checkout.adyen-notification')->post('/adyen-notification', 'Shop\\CheckoutController@adyenNotification');
VerifyCsrfToken.php 中的設置:
protected $except = ['*/adyen-notification?*'];
自定義表格:
<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE¤cy=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
<input type="submit" value="SUBMIT">
</form>
我不明白為什么它給了我 301 響應。
您的表單操作中有拼寫錯誤,缺少右引號:
<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE¤cy=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099>
<input type="submit" value="SUBMIT">
</form>
應該:
<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE¤cy=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
<input type="submit" value="SUBMIT">
</form>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.