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 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏