![](/img/trans.png)
[英]CURL GET Request redirects me to a 404 Error , although the URL works perfectly
[英]GET request works with CURL but not as a URL
這是兩個GET
請求。 第一個在php
使用CURL
起作用,但是第二個由HTML form
生成的接收到來自響應服務器的錯誤。
第一個(有效的)是使用CURL的GET請求
1。
curl 'https://api.authy.com/protected/json/phones/verification/start' \
-d api_key=my_key\
-d via=sms \
-d phone_number=my_number\
-d country_code=my_code
第二個(無效)是GET請求URL,例如從html表單<form method='get'>
生成的URL
2。
https://api.authy.com/protected/json/phones/verification/start?api_key=my_key&via=sms&phone_number=my_number&country_code=my_code
使用第二個響應服務器時,來自響應服務器的錯誤消息是:
{"message":"Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs","success":false,"errors":{"message":"Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs"},"error_code":"60000"}
題
第二個GET請求與CURL GET請求之間有什么區別? 他們在我看來就像他們一樣。
根據https://www.twilio.com/docs/verify/api/verification上的文檔,您應該使用POST
請求來使用該API,這就是cURL的-d
選項的作用。
在第二個調用中,您發送一個GET
請求,並且根據文檔和錯誤消息,該請求不成功。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.