Jump to content
  • Advertisement
Sign in to follow this  
PezPersonne

C++ program communication with a PHP server.

This topic is 4812 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, Here is my problem. I need to make communicate my C++ application with a php page located on a distant server. The program must be able to do this: - To send the infos : user=yar mdp=yar on the server page CheckPwd.php - The server must be able to recover this information and return a code to the client program. - The client program must be able to read this code Do you know which method could I use ? Could I use wininet.lib and httpsendrequest, httpopenrequest ? I hope you understand me :o) Thank you for your answers

Share this post


Link to post
Share on other sites
Advertisement
I've used libcurl as a makeshift 'master server' for a game I was working on.

With libcurl I generated an http request such as

http://www.mysite.com/getserverlist.php?game=MyGameName

The php scripts job was to get all the servers in the database that match the game name and generate and xml, which libcurl would then download and allow me to parse.

When servers were launched, and and periodically they would send a heartbeat to the server in a similar way.

http://www.mysite.com/serverheartbeat.php?game=MyGameName&ip=xxx.xxx.xxx.xxx&players=10

The serverheartbeat.php would update the database along with a timestamp, so getserverlist.php would only return servers that have a timestamp < the heartbeat delay.

It's not ideal but it works well enough for a small scale game to use as a 'master server'

Anyways to answer your question, libcurl is good and cross platform. Can handle http and ftp. Can double as a downloader if you want.

If its simple and you're using windows only, the functions you mention can be used just as well.

Share this post


Link to post
Share on other sites
Thank Dr Evil for your answer !

Libcurl seems to be appropriated, but i dont't think it works for me because I don't have rights to install it ont the server.

<If its simple and you're using windows only the functions you mention can be used just as well.>

I hope :o) but I don't know how :o))

Thank

Share this post


Link to post
Share on other sites
You don't install it on the server. You just use it in your program. The only thing the server needs is the php scripts that do whatever you need them to do and generate your page of data that will be downloaded by your program.

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!