dounao1856 2015-07-19 11:42
浏览 43
已采纳

无法运行此PHP脚本

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);

?>
  • 写回答

1条回答 默认 最新

  • dsc7188 2015-07-19 11:46
    关注

    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
                    )
    
            )
    
    )
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突