douqiaotong8682 2018-04-16 08:54
浏览 131

504网关超时php

i'm running script(svc/rest services) that request a server which response me a XML string.. this request is going through an intermediate server.

My aim is to fetch the details of guests o.e. rooms which will be response..

but after certain number of request i am getting 504 gateway out and only about 40 rooms are able to retreived

1: file...source hots

$ROOMS = ["301","302","304","305","306","307","308","309","310",
          "311","312","314","315","316","317","318","319","320",
          "401","402","403","404","405","406","407","408","409",
          "410","411","412","414","415","416","802","802","802",
          "802","802","802","802","802","802","802","802","802",
          "802","802","802","802","802","802","802","802","802",
          "802","802","802","802","802","802","802","802"
];
// all rooms more than 75

for ($x = 0; $x < count($ROOMS); $x++){
    $end_point = "https://www.innkeyapp.com/SerRest.svc/GetOccupiedRoomData";
    $sharedkey = "2diSq8bjZ4N3ZR4XB5KXXXXXXXXXXXXXXXXXXXXXXX";
    $url       = 'https://eastern-services.com/innkeyPMS_room_ststus.php';
    $room_no   = $ROOMS[$x];
    $postdata  = http_build_query([
        'end_point' => $end_point,
        'room_no'   => $room_no,
        'sharedkey' => $sharedkey
    ]);  
    $opts = [
        'http' => [
            'method'  => 'POST',
            'content' => $postdata
        ]
    ];
    $context   = stream_context_create($opts);   
    $result    = file_get_contents($url, false, $context);  
    $arrayData = json_decode($result,true);  
    if (empty($arrayData)) {  
        // Redirect('failure.php?msg=Error in service');  
        echo "Error in Service";  
        exit();  
    }  
    print_r($arrayData);  
    echo $room_no."Added";  
}  

2: file.... innkeyPMS_room_ststus.php i.e. intermediate host.

$room_no   = $post_var['room_no'];
$end_point = $post_var['end_point'];
$sharedkey = $post_var['sharedkey'];

$registerno = '';
$prprtxt    = '';
$validunit  = '';

// echo $post_var;

function curl_get_file_contents($URL)
{
    return file_get_contents($URL);
}

$xmlString = curl_get_file_contents(
     $end_point.'sharedkey='.$sharedkey.'=&roomno='.$room_no
);
$xml = simplexml_load_string($xmlString);
header("Content-Type: application/json");
echo json_encode($xml);

why this connection is getting lost or why its showing 504 gateway time out?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥120 计算机网络的新校区组网设计
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单