Jump to content
  • Advertisement
Sign in to follow this  
Toadhead

Connecting to a webserver

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just wondering if it is possible to connect to a webserver using a C++ application and if so how? I mean what if I want to create a program that contains a button, and when I press the button it will open http://www.testsite.com/counter.php and it should let the testcounter raise by 1 (the site doesnt excist but is just an example). Or what if I want to create an application that automaticly grabs all news on a website and save it as a *.txt file. I guess I should use some kind of networking library for it such as SDL_net, Winsock etc. but I whish someone could clear this out for me. Let's say I use SDL_net, I need to use http protocols or something? And is this possible with this library? I'm confused about it and I hope someone could help me with it. Thanks, Rob

Share this post


Link to post
Share on other sites
Advertisement
it's basically just a matter of opening a socket to the webserver, sending it a HTTP 'GET' request and receiving the output via the recv() function. if you just want to incr. a php counter then that's all. downloading a file would be a bit harder since you would have to manually parse the http header, handle file io etc.

if you need some sample source there's a very small program somewhere called gethttp.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!