I am doing a project in which my Arduino needs to connect to a simple web page and retrieve the content of a text file. I want to use curl to see the response I would get if I sent the following HTTP request once connected to example.com (the website in my actual project is a different one) so that I can devise a parse for the contents of commandPage.txt:

GET /commandPage.txt HTTP 1.1
Host: example.com
Connection: close

How can I use curl to send the request and see the full response?


What you're asking for is simply:

curl http://example.com/commandPage.txt

This will get you the contents of that URL.

If you need to see the headers as well, you can add -v.

Otherwise, you can even use telnet to do so. Just use:

telnet example.com 80

And paste the full request as quoted above, followed by one empty line.

  • Thank you! The telnet did not work for me, but the curl worked! Yes, I didn't mean to put the mail.horacemann.org. Oops. – Richard Hausman Jan 29 '16 at 14:39
  • I have edited your question (pending approval) and my answer. – jcaron Jan 29 '16 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .