504网关超时php

时间:2018-04-16 08:54:09

标签: php

我正在运行脚本(svc / rest服务),它请求服务器响应我的XML字符串..此请求通过中间服务器。

我的目标是获取客人的详细信息。房间将作出回应..

但经过一定数量的请求后,我将获得504个网关,只有大约40个房间可以转发

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即中间主持人。

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

为什么这个连接会丢失或为什么显示504网关会超时?

0 个答案:

没有答案