Jump to content
  • Advertisement
Sign in to follow this  
md_lasalle

Talking to a php page via sockets

This topic is 4101 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

Hello all, I'd like to have your inputs on what would be the best way to A) Download the content of an html/php page from a C/C++ program B) Send a form via POST to a PHP page (from the C program) The tricky part : i want to do it with internet sockets send/recv After some research, looks like libcurl would best suit my need. But for the experience, I would like to do it directly with the sockets. Thanks for any lights on this.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
The tricky part : i want to do it with internet sockets send/recv

After some research, looks like libcurl would best suit my need. But for the experience, I would like to do it directly with the sockets.


Ok, so you'll implement HTTP protocol, along with all the queries and required handlings, encodings, as well as streaming logic.

So... why not use an existing library?

HTTP isn't a complex protocol, but it's an annoying one. If this is for broad general use, you'll need to support it reliably, including various security extensions.

If it's for one particular page only - why waste time?

The easiest way to do this bare bones is probably to manually construct HTTP requests strings, and send those. It might be possible to even ignore the result. Just go through HTTP RFC to see what you need to send.

wget or wput (is there such a thing, or can wget do it?) should solve this without programming altogether.

Share this post


Link to post
Share on other sites
Curl is fine. I recommend you use it.

If you want to see how to get the output of a page using WinSock, try the HTTP-GET sample on my web page. Simple code you can just drop in, and it will let you get any web page (including PHP pages).

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!