C++ Make HTTP Request?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
toasty2
Forum Contributor
Posts: 361
Joined: Wed Aug 03, 2005 10:28 am
Location: Arkansas, USA

C++ Make HTTP Request?

Post by toasty2 »

I've searched a ton for how to do this but couldn't find any definitive code examples. First of all I'd like to say I'm not much of a C++ guy. I only know some of the basics of the language. I was wondering if anyone could either point me to or give me any examples for sending off a HTTP (GET) request. I'm programming on Windows using Dev-C++ and I guess I want to use Winsock unless you have a better idea. This will be a console application.

So basically I guess I need to connect to a server, send it:
GET /path/file HTTP/1.1
Host: website.tld

Thanks in advance.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: C++ Make HTTP Request?

Post by timvw »

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: C++ Make HTTP Request?

Post by Chris Corbyn »

timvw wrote:Happy reading: Beej's Guide to Network Programming.
Awesome :D
That web page wrote:4. System Calls or Bust
4.1. socket()—Get the File Descriptor!
4.2. bind()—What port am I on?
4.3. connect()—Hey, you!
4.4. listen()—Will somebody please call me?
4.5. accept()—"Thank you for calling port 3490."
4.6. send() and recv()—Talk to me, baby!
4.7. sendto() and recvfrom()—Talk to me, DGRAM-style
4.8. close() and shutdown()—Get outta my face!
4.9. getpeername()—Who are you?
4.10. gethostname()—Who am I?
4.11. DNS—You say "whitehouse.gov", I say "63.161.169.137"
:lol:
Post Reply