help with aws rekognition and php

0

Hello good afternoon I am using the aws SDK and php but I get an error and I do not know how to solve it I would appreciate your help very much thanks in advance.

require '../../vendor/autoload.php';
use Aws\Rekognition\RekognitionClient;

$credentials = new Aws\Credentials\Credentials('*******', '******');

$rekognitionClient = RekognitionClient::factory(array(
        'region'    => 'us-east-2',
        'version'   => 'latest',
    'credentials' => $credentials,
    //'debug' => true, 
));

$compareFaceResults= $rekognitionClient->compareFaces([
    'SimilarityThreshold' => 80,
    'SourceImage' => [
        'Bytes' => file_get_contents("test.jpg")
    ],
    'TargetImage' => [
        'Bytes' => file_get_contents("test1.jpg")
    ],
]);

 $FaceMatchesResult = $compareFaceResults['FaceMatches'];
 $SimilarityResult =  $FaceMatchesResult['Similarity']; //Here You will get similarity
 $sourceImageFace = $compareFaceResults['SourceImageFace'];
 $sourceConfidence = $sourceImageFace['Confidence']; //Here You will get confidence of the picture

'Error retrieving credentials from the instance profile metadata server. (cURL error 28: Connection timed out after 1000 milliseconds (see link )) 'in C: \ xampp \ vendor \ aws \ aws-sdk-php \ src \ Credentials \ InstanceProfileProvider.php: 88 Stack trace: # 0 C: \ xampp \ vendor \ guzzlehttp \ promises \ src \ Promise.php (203): Aws \ Credentials \ InstanceProfileProvider- > Aws \ Credentials {Closure} (Array) # 1 C: \ xampp \ vendor \ guzzlehttp \ promises \ src \ Promise.php (156): GuzzleHttp \ Promise \ Promise :: callHandler (2, Array, Array ) # 2 C: \ xampp \ vendor \ guzzlehttp \ promises \ src \ TaskQueue.php (47): GuzzleHttp \ Promise \ Promise :: GuzzleHttp \ Promise {closure} () # 3 C: \ xampp \ vendor \ guzzlehttp \ guzzle \ src \ Handler \ CurlMultiHandler.php (98): GuzzleHttp \ Promise \ TaskQueue->> run () # 4 C: \ xampp \ vendor \ guzzlehttp \ guzzle \ src \ Handler \ CurlMultiHandler.php (125): GuzzleHttp \ Handler \ CurlMultiHandler-> tick () # 5 C: \ xampp \ vendor \ guzzlehttp \ promises \ src \ Promise.php (246): Gu in C: \ xampp \ vendor \ aws \ aws-sdk-php \ src \ Credentials \ InstanceProfileProvider.php on line 88

    
asked by douglas 15.11.2018 в 23:17
source

1 answer

0

Apparently it's a connection problem, do you have any proxy?

Try modifying the parameters of the Curl that your Guzzle library uses so you do not vote timeout

curl_setopt($curl, CURLOPT_TIMEOUT,0);
    
answered by 16.11.2018 в 18:15