我有以下代码,使用名为Import.io的Web服务,该服务接收URL并返回JSON结构。在我的本地堆栈上它可以很好地工作,但是当我将它部署到AWS时,我只是得到了Chrome' No Data Received'包含代码Error 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);