1

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 [email protected]: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 Answers 3

2

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 [email protected]:test http://www.example.com/mappingFile 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply Mr. Juned. I already accepted the previous answer even though your answer is perfect because it comes first. sorry for that.
2

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.

1 Comment

Thanks for the reply Mr. User. If i use like that i am getting 400 bad request exception
1
curl -d "appid=1234567" --header "username:[email protected]" --header "password:test" >> output.apk http://example.com/fileName.apk 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.