Advertisement
Guest User

Untitled

a guest
Dec 12th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. // URLs of targets
  3. $baseUrl['rb'] = 'http://ci.bukkit.org/job/dev-CraftBukkit/Recommended/artifact/target/';
  4. $baseUrl['edge'] = 'http://ci.bukkit.org/job/dev-CraftBukkit/lastSuccessfulBuild/artifact/target/';
  5.  
  6. // Config options
  7. $defTarget = 'rb';
  8.  
  9. /* Code */
  10. $target = $defTarget;
  11. if (isset($_GET['edge'])) $target = 'edge';
  12.  
  13. $fh = fopen($baseUrl[$target], 'r');
  14. if (!$fh) {
  15. notFound();
  16. }
  17. while (!feof($fh)) {
  18. $line = fgets($fh);
  19. if (strpos($line, 'fileList') !== false) {
  20. $uStart = strpos($line, '<a href="') + 9;
  21. $uEnd = strpos($line, '">', $uStart);
  22. $url = substr($line, $uStart, $uEnd - $uStart);
  23. break;
  24. }
  25. }
  26. fclose($fh);
  27. if (isset($url)) {
  28. header('Location: '.$baseUrl[$target].$url);
  29. } else {
  30. notFound();
  31. }
  32.  
  33. function notFound() {
  34. header('HTTP/1.0 404 Not Found');
  35. die();
  36. }
  37. ?>
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement