Skip to content

Instantly share code, notes, and snippets.

@holydevil
Created August 20, 2011 12:43
Show Gist options
  • Save holydevil/1159060 to your computer and use it in GitHub Desktop.
Save holydevil/1159060 to your computer and use it in GitHub Desktop.
Get PNR status using Alagu's API
<?php
error_reporting(1);
//$url = "http://pnrapi.alagu.net/api/v1.0/pnr/6359817259?jsonp=parseJSON";
$url = "http://pnrapi.alagu.net/api/v1.0/pnr/6359817259";
$ch = curl_init($url);
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$out_arr = json_decode($output);
//var_dump($output);
echo "<pre>";
print_r($out_arr);
echo "</pre>";
echo "example " . $out_arr->status;
?>
@gitsearcher
Copy link

is there any way we can get the pnr status data from https://pnrstatus.com or https://railenquiry.in in json format ?
railenquiry send and receives request by ajax but they have a strong ip blocking system, is there any other way ? The above code is also not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment