curl -d "appid=1234567" --header "username:test@test.com" --header "password:test" >> output.apk http://example.com/fileName.apk
curl url with post data, username and password and response as file
-
23-07-2023 - |
Question
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.
La solution 3
Autres conseils
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
.