문제

I am using to call a url from command prompt of curl. The url contains post data, user name and password. Added to that the response should be a file if authenticates or shows generally 401 response. I have been trying to find out the solution for the last 2 hours, but cant able to do that. For example i want to send two values(x,y) using post and with that i am sending the username and password also, say for instance

curl -u test@test.com:test http://www.example.com/mappingFile

if i sending like this i am getting

<html><head><title>Error 405 Request method 'GET' not supported</title></head>
<body><h2>Error 405 Request method 'GET' not supported</h2></body>
</html>

Please any body can help me.

도움이 되었습니까?

해결책 3

curl -d "appid=1234567" --header "username:test@test.com" --header "password:test" >> output.apk http://example.com/fileName.apk

다른 팁

You are not posting any data with the curl command and hence it is going as a GET instead of POST. Here is how you can send the POST request using --data option:

curl --data "dummyparam=dummvalue" -u test@test.com:test http://www.example.com/mappingFile

In your case you send the data via GET. use curl --request POST to send data via POST. The data you can add with the option --data.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top