In the code bellow I am trying to get the result of PNR Status
But don't know how to proper use it to call function
URL - https://github.com/ankitpise/OpenIrctc
error - Internal Server Error
<?php
include 'OpenIrctc.php';
$irctc = new OpenIrctc(6643704951); // $pnr_number = null by default
$irctc->set_language(); // english / hindi. English by default
$irctc->pnr_full_check(6643704951); // not necessary to pur $pnr number if initiated library with it.
$status= json_decode($data);
print_r($status);
var_dump($status);
?>
Your 500 error is likely caused by not having $data
declared.
Use it like so:
include 'OpenIrctc/OpenIrctc.php';
$irctc = new OpenIrctc(6643704951);
$irctc->set_language('hindi');
$data = $irctc->pnr_full_check();
print_r($data);
Also, the script does not return a json (pnr_full_check()
calls reader_array()
which returns an array)
This is the output:
Array ( [6643704951] => Array ( [status] => success [train_info] => Array ( [train_no] => 13287 [train_name] => साउथबिहार एक्स. [train_date] => 24- 7-2015 [train_from] => टाटानगर जं. [train_to] => BIHA [train_res_to] => BIHA [train_res_from] => टाटानगर जं. [train_res_class] => तृतीय वातानुकूलित ) [यात्री 1] => Array ( [booking_status] => W/L 8,RLGN [current_status] => W/L 8 ) [चार्ट तैयार नहीं ] => Array ( [charting_status] => W/L 8 ) ) )