Я пытаюсь перечислить свои IOT вещи из Amazon AWS со стороны PHP на внешнем сервере.
Я использую AWS PHP SDK, но не могу понять, что происходит не так.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'aws/aws-autoloader.php';
$access_key="xxx"; //Access key
$secret_key="xxxx"; // Secret
$client = Aws\IoT1ClickDevicesService\IoT1ClickDevicesServiceClient::factory(array(
'region'=> 'eu-west-1',
'version'=>'2018-05-14',
'credentials' => array(
'key' => $access_key,
'secret' => $secret_key,
)));
$result = $client->listDevices();
print_r($result);
?>
Я ожидал список устройств, но получил следующую ошибку:
Fatal error: Uncaught exception 'Aws\IoT1ClickDevicesService\Exception\IoT1ClickDevicesServiceException' with message 'Error executing "ListDevices" on "https://devices.iot1click.eu-west-1.amazonaws.com/devices"; AWS HTTP error: cURL error 6: Could not resolve host: devices.iot1click.eu-west-1.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: devices.iot1click.eu-west-1.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /customers/9/a/c/firstform.dk/httpd.www/ota/aws/GuzzleHttp/Handler/CurlFactory.php:185 Stack trace: #0 /customers/9/a/c/firstform.dk/httpd.www/ota/aws/GuzzleHttp/Handler/CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 /customers/9/a/c/firstform.dk/httpd.www/ota/aws/GuzzleHttp/Handler/CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlMultiHandler), Object(GuzzleHttp\Handler in /customers/9/a/c/firstform.dk/httpd.www/ota/aws/Aws/WrappedHttpHandler.php on line 195