Php cURL使用create_对象在amazon SDK中制造麻烦
我正在尝试将图像上载到S3存储桶。不幸的是,我遇到了一个奇怪的错误,在谷歌上找不到任何东西Php cURL使用create_对象在amazon SDK中制造麻烦,php,amazon-s3,amazon-web-services,Php,Amazon S3,Amazon Web Services,我正在尝试将图像上载到S3存储桶。不幸的是,我遇到了一个奇怪的错误,在谷歌上找不到任何东西 $s3 = new AmazonS3(); $bucket = 'myBucket'; $fileResource = 'test.JPG'; $response = $s3->create_object($bucket, $filename, array('fileUpload' => $fileResource)); print_r($response); 执行脚本时,我收到以下消息:
$s3 = new AmazonS3();
$bucket = 'myBucket';
$fileResource = 'test.JPG';
$response = $s3->create_object($bucket, $filename, array('fileUpload' => $fileResource));
print_r($response);
执行脚本时,我收到以下消息:
Fatal error: Uncaught exception 'RequestCore_Exception' with message 'cURL resource: Resource id #20; cURL error: select/poll returned error (55)' in /home/myproject.com/public_html/aws/lib/requestcore/requestcore.class.php:817 Stack trace: #0 /home/myproject.com/public_html/aws/services/s3.class.php(688): RequestCore->send_request() #1 /home/myproject.com/public_html/aws/services/s3.class.php(1286): AmazonS3->authenticate('myBucket', Array) #2 /home/myproject.com/public_html/myScript.php(16): AmazonS3->create_object('myBucket', NULL, Array) #3 {main} thrown in /home/myproject.com/public_html/aws/lib/requestcore/requestcore.class.php on line 817
有什么想法吗?cURL在其他文件中运行良好 我认为这个问题源于使用较旧版本的OpenSSL或cURL。帮助我解决此问题的一种解决方法是使用以下方法:
$response = $s3->create_object(
$bucket,
$filename,
array(
'fileUpload' => $fileResource,
'curlopts' => array(CURLOPT_FORBID_REUSE => true),
)
);
curlopts标志告诉S3的curl包装器不要重用它创建的任何SSL连接。另一个可能的解决方案,via,建议使用disable_ssl方法,这对我来说不是一个好办法。我认为这个问题来自于使用较旧版本的OpenSSL或cURL。帮助我解决此问题的一种解决方法是使用以下方法:
$response = $s3->create_object(
$bucket,
$filename,
array(
'fileUpload' => $fileResource,
'curlopts' => array(CURLOPT_FORBID_REUSE => true),
)
);
curlopts标志告诉S3的curl包装器不要重用它创建的任何SSL连接。另一个可能的解决方案是via,建议使用disable_ssl方法,这对我来说不是一个好办法。试试看
$file_path = 'test.JPG' ;
$file_resource = @fopen($file_path, 'r');
$content_type = CFMimeTypes::get_mimetype('.jpg');
$params = array( 'fileUpload' => $file_resource,
'contentType' => $content_type);
$response = $s3->create_object($bucket_name, $object_name, $params );
试一试
55=发送网络数据失败。。您确定curl指向的url有效吗?55=发送网络数据失败。。您确定curl指向的url有效吗?