Advertisement
Guest User

Untitled

a guest
May 6th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. $url = 'http://api.sl.se/api2/realtimedepartures.json?key=xxxx&siteid=9192&timewindow=30';
  3. $jsondata = file_get_contents($url);
  4.  
  5. $json = json_decode($jsondata,true);
  6.  
  7.  
  8. foreach($json['ResponseData']['Metros'] as $metro){
  9. if($metro['DisplayTime'] != "Nu"){
  10. $output .= "<ul><li><strong>".$metro['DisplayTime'].".</strong> </li>";
  11. }
  12. else{
  13. $output .= "<ul><li><strong>".$metro['DisplayTime']." avgår </strong></li>";
  14. }
  15. $output .= "<li>".$metro['GroupOfLine']."</li>";
  16. $output .= "<li> nr ".$metro['LineNumber']." </li>";
  17.  
  18. $output .= "<li> till<strong> ".$metro['SafeDestinationName']."</strong></li></ul>";
  19.  
  20. }
  21.  
  22. echo $output;
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement