sending HTTP POST using curl command

September 15th, 2007 mysurface Posted in curl, Network | Hits: 1286526 | 39 Comments »

Recently I was having fun with libcurl, discovered that with curl command I capable of doing HTTP POST with specified User-agent string. For those who have no idea what is curl, curl is a powerful client tool for accessing servers through FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP, please find more info from cURL official site.

Mypapit has written a good post illustrate how to create a simple bot script using php with curl bindings. By calling curl function in php, you can do a HTTP POST to a web server’s page. Well, with curl command in bash, you can do the same, and it consist of just one line.

Mypapit is kind enough to provide his HTTP POST server’s script in php for testing purpose. Download his sample codes and load it to your apache server and you can try out the command lines shows later. What you need is target.php and target.txt, remember to chmod a+w target.txt.

To send HTTP POST request, you can do it with -F, I show you a simple example that sending username to the web server.

curl -F 'username=mysurface'

And result returns

data was submitted successfully

Check out the target.txt, gives the line

username : mysurface (curl/7.15.5 (i486-pc-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5)

p.s mypapit’s target.php logs submitted username and it’s user-agent into file target.txt. The result showing above indicates that the submission was done by curl.

Well, you can override the default user-agent string by -A

curl -F 'username=mysurface' -A 'Mozilla/4.0'

Therefore you have this in your target.txt

username : mysurface (Mozilla/4.0)

Having fun? curl command capable of doing a lots more!

39 Responses to “sending HTTP POST using curl command”

  1. […] sending HTTP POST using curl command Recently I was having fun with libcurl, discovered that with curl command I capable of doing HTTP POST with specified Us… […]

  2. -d worked for me instead of -F
    all in all a powerfull tool, thanks for the article.
    I use it to disconnect my Router with one Click.

  3. yeah -d is a better option if you’re have more than one “key=value” pair. My url had 3. Great Article thanks!

  4. -d is for GET -F is for post.

  5. scratch that, im retarted thnx.

  6. Giacomo Vacca Says:

    If you want to send an XML in your request:

    curl –header ‘content-type: text/xml’ –data @request.xml -X POST

    If you want to use HTTPS (ignoring invalid certificates):

    curl -k –header ‘content-type: text/xml’ –data @request.xml -X POST

  7. I had never heard of curl… Live and learn…

    Worked fantastic under cygwin.
    We are using it now at


  8. excent

  9. I’d always want to be update on new content on this web site , saved to my bookmarks ! .

  10. How can we make https request ?

  11. test

  12. test again

  13. this link will help u

    a simple example for post using curl

  14. a simple example for post using curl will help this to post using curl.

  15. Technical spy software records all type keystrokes activities like online chat conversation, password, username and composed email id.

  16. I’d like to pay this cheque in, please factory model teen I love this girl but ever sence she had a kid all she does is blow job vids and any time you see her she is covering up her belly and not getting fully into it. dont get me wrong she is one of the hottest girls I have ever seen but if you have a couple of stretch marks cause of a kid dont let it get the better of you.

  17. I’m originally from Dublin but now live in Edinburgh banned nymphet pic i do not like too wait till the fuck scene comes by staring at a guys ass the entire time

  18. I’m doing a phd in chemistry model24 bbs why does it always end in CIF? i dont mind but I prefer CIM with a bit of extra pouring out.. nice girl, lucky guy.

  19. Howdy, i read your blog occasionally and i own a similar one and i was just wondering if
    you get a lot of spam comments? If so how do you stop it, any plugin
    or anything you can advise? I get so much lately it’s driving me insane so any help is very much appreciated.

  20. I don’t like pubs lolita lust collection pics lol I wonder how many people were disappointed that there wasn’t any of this in the TV show Brothers and Sisters…

  21. Have you got any ? real lolita modles ass definitely schoolgirls that can’t suck a dick. open up your mouth and let that fucker down your throat. fucking sexy when he takes it out and puts his cock in the other one’s mouth. they can’t even take the entire cock in their twats. lame.

  22. What line of work are you in? teen porn lolitas top Hot little tighty. I’d bang the shit outta her.

  23. Now I?im going to hate his original then thought it is because my crow mouth is highly efficacious. If not I would thought grandpa will be suffered from the flesh. Nevertheless, many of the book’s hardcore fans found the movie to be less than perfectly true to the novel, with some concepts added in and the ending substantially changed. Slaughterhouse-Five is a novel by Kurt Vonnegut Jr that was turned into a film directed by George Roy Hill and written by Stephen Geller. jordan retro 13

  24. You’ve done more in the past twenty-plus weeks than most guys do in a decade. This has been a great ride.”. It’s the one particular you beat the rush hour for so as to open that door, take a deep breath and sigh with pleasure and satisfaction figuring out everything’s flawless, including the ceiling fans that other individuals take for granted. No mater what your taste are or how selective your significant other is there is positive to be one that will please all and at cost-effective rates too!You’ll discover indoor and outdoors, modern-day and retro, transitional and traditional and also go for that classic always-in-style 1. jordan space jams

  25. The greatest factor that will help your keep your marriage just isn’t your therapist but you and your companion. The objective of your marriage counselor is to pay attention to and evaluate your state so that he/she may give professional tips. The 8-inch high uppers not only protect you against rocks and brambles, but are part of a guaranteed waterproof system. These are made of full grain water-resistant leather and Cordura, the abrasion-resistant, breathable nylon that is ten times more durable than cotton duck , is llightweight, and dries faster than leather. jordan space jams

  26. Recorded Delivery

  27. Hi there, yeah this post is actually pleasant and I have learned lot of things from it concerning blogging.

  28. Excellent post. I used to be checking constantly
    this blog and I’m inspired! Extremely useful information particularly the ultimate section :) I handle such info much.
    I used to be seeking this particular info for a very lengthy time.
    Thanks and best of luck.

  29. ?’m gone to convey my little brother, that he should also visit
    this webpage on re?ular basis to obtain updated from newest gossip.

  30. I savour, lead to I discovered just what I was having a look
    for. You’ve ended my 4 day lengthy hunt! God Bless you man.
    Have a nice day. Bye

  31. I must thank you for the efforts you’ve put in writing this blog.

    I am hoping to see the same high-grade blog posts from you
    in the future as well. In fact, your creative writing abilities has
    motivated me to get my own website now ;)

  32. If you wish for to take a good deal from this paragraph then you
    have to apply such techniques to your won website.

  33. Great article!

  34. Great article!

  35. chompandslurp wordpress com 2011 11 25 saffs cafe lunch

  36. Um passeio surpreendente na região de Londrina é o Salto do Apucaraninha. Dentro da reserva dos índios Kaingang (por isso sua visita deve ser autorizada pela Funai), a 80 km ao sul do centro da cidade, o salto é uma queda d’água de 116 metros de altura que impressiona pela força das águas e tamanho da queda. Confira no site AltaMontanha um relato com dicas de como chegar lá.
    brown timberland roll top boots's-Timberland-Roll-Top-Boots.html

  37. Video production Houston

Leave a Reply