this is purely an academic question.
question: What is the best way to handle version checking in php.
example: Let's say I have a CMS like script and so does other users, and I have the version number defined somewhere in the script, and on a certain page, it should compare the current version number with the version hosted on my server or a SVN/GIT repo.
I'm not looking for an entire script, I just need someone to point me in the right direction to find the "best"/most recommended practice.
like is it possible to get data off a specific URL on a different server? or is it better to do this via ajax and just print the version number in a hidden field?
What kind of half-baked language would PHP be if it couldn't make network connections? Here's an example:
$version = file_get_contents("http://www.example.com/script-that-returns-current-version-number.php");
if ($version != CURRENT_VERSION)
echo "You need to upgrade. You're running version " . CURRENT_VERSION . " but the current version of this script is $version.";
That's all there is to it.
Personally i like using mod_rewrite to spoof a URL to the version tracker so the url would be something like "example.com/version.json" but really it would link to the file like Dan Grossman showed in his example above.
@Dan Grossman Oh cool, I never would have thought it was that simple. Here I was thinking that there was some magic library or class or whatever that I'll have to download... haha thanks for the info.