C++ program communication with a PHP server.
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
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.
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.
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement