0

Alright so We have a simple PHP-File on my server that echo's back a version-number. When the builder is ran, it checks if the Version from the PHP-File is the same as the version-number hardcoded in the builder, if not it replaces itself with the new download (Which is on my server aswell) How could I put this in my C++ code? Thanks for any help.

1 Answers1

0

You need to download the output of the php script on the client PC and parse the text to get the version number.

To do this, you need to use a library that allows you to download a page from the internet. This is just like getting the html output of a web page (eg. for google.com)

I don't know what platform you are using, but here are some libraries you can use to download a file from the internet:

You can find libcurl examples here: Download file using libcurl in C/C++ and [C/C++] How To Get The HTML Of a Web Page

You can find a URLDownloadToFile example here: How to download HTML with C++

For the URL you should use the path to the php file on your server (eg. "www.tasty.de/zero.php") You can save the output to a temp file on the disk (or maybe even keep it in memory) and then you have the version string. From there it's straightforward to parse the version number out of the string.

Community
  • 1
  • 1
Ove
  • 6,227
  • 2
  • 39
  • 68