Advertisement
Guest User

hugcode

a guest
Oct 6th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="utf-8" />
  5.  <title>Buses from Kingston MakerLabs</title>
  6. <meta http-equiv="refresh" content="16">
  7. <meta name="viewport" content="width=device-width">
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <style type="text/css" media="screen">
  10.    body {
  11.      background-color:#000;
  12.      color:#FFA500;
  13.      font-family: Tahoma, Geneva, sans-serif;
  14.      font-size:1.2em;
  15.    }
  16.   </style>
  17.  
  18.  
  19. <body>
  20. <!-- insert comment here -->
  21. <!-- there is some php code here that can be found in
  22.  https://github.com/KingstonMakerLabs/kml-tfl-countdown
  23. please contribuite! This software is released under AGPL 3 or later
  24. see https://www.gnu.org/licenses/agpl-3.0.html for more details.
  25. -->
  26. <header>
  27. <h4>Buses from Ham Library</h4><img src="huglogo.png" style="float:right;">
  28.  
  29. </header>
  30. <?php
  31. $name = "Ashburnham Road to Richmond";
  32. $stopnumber = 51750;
  33. display ($name,$stopnumber);
  34.  
  35. $name = "Ashburnham Road to Kingston";
  36. $stopnumber = 56822;
  37. display ($name,$stopnumber);
  38.  
  39. //$name = "Mariner Gardens to Richmond";
  40. //$stopnumber = 57780;
  41. //display ($name,$stopnumber);
  42.  
  43. //$name = "Mariner Gardens to Kingston";
  44. //$stopnumber = 57522;
  45. //display ($name,$stopnumber);
  46.  
  47.  
  48. function display ($head,$num)
  49. {
  50.     $url = "http://countdown.tfl.gov.uk/stopBoard/$num";
  51.    $result= file_get_contents($url);
  52.    $info =  (json_decode($result,true));
  53.    $line = 0;
  54.    
  55.    echo("<section>
  56.     <h5>$head<h5>
  57.     <pre>");
  58.    foreach ($info['arrivals'] as $bus ) {
  59.         ++$line;
  60.         printf("%-2d %-4s %-16s%2d min\n",$line,$bus['routeName'],$bus['destination'],$bus['estimatedWait']);
  61.    }
  62.    echo("</pre>
  63.     </section>");
  64. }
  65. ?>
  66. More features? Just ask/join Richmond Makerlabs
  67. who working on it
  68. http://wiki.richmondmakerlabs.uk
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement