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.
C++ Make HTTP Request?
Moderator: General Moderators
Re: C++ Make HTTP Request?
Happy reading: Beej's Guide to Network Programming.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: C++ Make HTTP Request?
Awesometimvw wrote:Happy reading: Beej's Guide to Network Programming.
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"