[DEV/WEB] Bukkit Version PHP script

Discussion in 'Bukkit Tools' started by Bertware, Nov 7, 2011.

Thread Status:
Not open for further replies.
  1. Offline



    I needed to get the latest dev and recommended version from bukkit for my GUI.
    But I found one problem. I'd have to read web pages,and get the version numbers out of the text or title.
    Since I had to download the whole page in that case, the code should take way too long to execute.
    Due to this, I decided to leave this work for my server, and wrote 2 PHP scripts.

    Developer.php and recommended.php are returning resp. the latest developer and recommended version. To do this they get the title of the Jenkins page,and process this string to the version number.

    Feel free to look how the files work, and edit.

    Example: http://automation.bertware.net/bukkit/example.php (The real files are showing only the numbers, this is an example that shows both numbers so you know its working ;) )
    - NOTE: Do NOT use this link in your programs or scripts! It's only an example, If you want to use these scripts please host them yourselves or find someone to host them. -

    Download: http://dl.dropbox.com/u/20426400/scripts.zip (3 files, recommended.php, dev.php and example.php (example.php is the file as in the example above) )

    I hope I helped some out.

  2. Offline


    This is beautiful :)
  3. Offline


    Thank you! These scripts should work as long as bukkit keeps using the jenkins software.
  4. Offline


    You might want to look at how we at SpaceBukkit did it, it's less lines of code (altough you'rs works flawlessly!)

    //(c) Bertware 2011
    $url 'http://ci.bukkit.org/job/dev-CraftBukkit/Recommended/';
    $file fopen ($url,"r");
    if (!
    $file) {
    "<p>Unable to open remote file.\n";
    while (!
    feof ($file)) {
    $line fgets ($file1024);
    /* This only works if the title and its tags are on one line */
    if (eregi ("<title>(.*)</title>"$line$out)) {
    $pieces explode("#"$out[1]);
    substr($pieces[1], -144);
            $filename 'http://ci.bukkit.org/other/latest_recommended.rss';
    $load_bukkit_version simplexml_load_file($filename);
    $link_to_latest $load_bukkit_version->channel->item->link;
    $l_bukkit_version get_string_between($link_to_latest"dev-CraftBukkit/""/");
  5. Offline


    I see, you are using the Rss feed. indeed some shorter :p
    However, at this moment it is working without problems, and I'm not sure if I'm going to keep this system for my apps.
    You load the whole XML file, which (I think) loads a bit slower (however, since server is executing this, you won't notice the difference?) but it's more powerfull. Thanks for the example, I think I'm going to use RSS too, and add some additional functions (compatibility, browsing trough latest 5 Recommended,...)...
  6. Offline


    Link broken?

    Fix pls :(
  7. Offline


Thread Status:
Not open for further replies.

Share This Page