Jump to content

livetrainstatus

New Members
  • Posts

    2
  • Joined

  • Last visited

livetrainstatus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thank you so much Muddy_Funster i got understood the concept now by using the ternary operator..i dont know how to apply before u said..now captured the things.thank u so much..many thanks
  2. I want to make a foreach loop to display the has_arrived status in php. when i tried with var_dump(has_arrived) it returned the output as false.but i want the output as, i have decoded and stored the decoded values in the $json variable Kindly help me to suggest the idea and help me to solve the issue my php code: <!DOCTYPE html> <HTML> <HEAD> <META charset="utf-8"> <TITLE>Train Status Time Table</TITLE> </HEAD> <BODY> <TABLE> <TR><TH>Station<TH>Scheduled<TH>Actual<TH>Status/Delay <?php $json = ''; if(isset($_GET['trainnumber']) && (isset($_GET['doj']))) { $url = 'http://api.railwayapi.com/live/train/'.$_GET['trainnumber'].'/doj/'.$_GET['doj'].'/apikey/jvtnb8382/'; $json = json_decode(file_get_contents($url), true); foreach($json['route'] as $stop) { echo ' <TR><TD>'.$stop['station'].'<TD>'.$stop['scharr'].'<TD>'.$stop['actarr'].'<TD>'.$stop['has_arrived'].'<TD>'.$stop['has_departed'].'<TD>'.$stop['latemin']."\n"; } } else { echo "Something went wrong, please notify to admin [support@livetrainrunningstatus.co.in]"; } ?> </TABLE> </BODY> </HTML>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.