Can I have my script check github for a update?

Is there a way to have my url shortening script to check github for a update or my forum http://technologx.96.lt/files/file/1-shortilicious-url-shortening-script/ ? This is the code I’ve got for the update check please keep in mind I didn’t write this script I’ve just done some revamping.

[php]<?php
$updateurl = “https://github.com/Technologx/Shortilicious-URL-Shortening-Script/commits/master”;
$fh = fopen($updateurl, ‘r’);
$version = fread($fh, 3);
fclose($fh);
$current = Shortilicious_NUMERICVERSION;
if ($version > $current && $version !== $current) {
echo “<p style=“color:green;”>A new version of Shortilicious is available! Download it at <a href=‘https://github.com/Technologx/Shortilicious-URL-Shortening-Script/commits/master’>https://github.com/Technologx/Shortilicious-URL-Shortening-Script/commits/master


”;
}
elseif ($version < $current && $version !== $current) {
echo “<p style=“color:blue;”>The Shortilicious version your using is up-to-date!
”;
}
?>[/php]

Sure, I’d suggest using an api client https://github.com/KnpLabs/php-github-api

Using that you only access the json api of github (instead of loading the web page - which you technically don’t need). It also comes including caching so you wont hit github needlessly much (and risk getting locked out)

Since I’m a noob at this how would I add the api to my code and do I need to download that zip file. If so what files do I need in that zip archive.

Sponsor our Newsletter | Privacy Policy | Terms of Service