PHP site works fine on local, net :: ERR_EMPTY_RESPONSE on AWS

I have the following code using the Import.io web service, which takes a URL and returns a JSON structure. It works fine on my local stack, however, when I deploy it to AWS, I just get a Chrome "Dataless" page with codeError code: ERR_EMPTY_RESPONSE

 $userGuid = "xxxx";
 $apiKey = "xxxx";

 function query($connectorGuid, $input, $userGuid, $apiKey, $additionalInput) {

   $url = "https://api.import.io/store/connector/" . $connectorGuid . "/_query?_user=" .      urlencode($userGuid) . "&_apikey=" . urlencode($apiKey);

   $data = array("input" => $input);
   if ($additionalInput) {
     $data["additionalInput"] = $additionalInput;
   }

   $ch = curl_init($url);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
   curl_setopt($ch, CURLOPT_POSTFIELDS,  json_encode($data));
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   $result = curl_exec($ch);
   curl_close($ch);

   return json_decode($result);
 }

// Query for tile TimeOutSearch
$result = query("2c2e8949-9b50-447a-bc97-8d10c6a91514", array(
  "webpage/url" => "http://www.timeout.com/london/search?     _source=global&profile=london&_dd=&page_zone=home&keyword=&on=&locationText=&_route=search&_route_params%5Bsite%5D=london&_route_params%5B_locale%5D=en_GB&page=1&type=event&order=popularity&page_size=10",
 ), $userGuid, $apiKey, false);
 var_dump($result);
+4
source share

Source: https://habr.com/ru/post/1539447/


All Articles