sending-post-data-using-curl-in-php

Sending post request using curl in php

Today we are going to learn about sending post request using curl in php.You can learn about basics of curl in my last article about using curl library in php “what-is-curl-in-php“.

Process of sending post request using curl in php

Find a form to submit using post method.

Get the url where the form get submitted.

http://tusharsharma.in/index.php#contact

Get form fields name.

userName,userEmailid,userMessage,sendmessage

curl-post-data-form-filling

curl-post-data-string

In above images, i used firebug to check the post request.In first image, i filled the form and opened firebug and click on persist button so that i can see post request. In second image, i have looked for form fields and also you can check the post data string in the image. By using following code, I will send a message by submitting a form i.e. sending data in post using curl.

When i check my mail, hurrah, i got the message.

curl-post-mail

That’s all for today, hope you enjoy and do try at home.

Leave a Reply