Getting a weird error I have no idea how to fix. This is the error:
( ! ) Catchable fatal error: Argument 2 passed to Guzzle\Service\Client::getCommand() must be an array, string given, called in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 93 and defined in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 113
Call Stack
# Time Memory Function Location
1 0.0009 676280 {main}( ) ..\test.php:0
2 0.0557 3311632 Aws\Ses\SesClient->send_email( ) ..\test.php:30
3 0.0557 3312128 Aws\Common\Client\AbstractClient->__call( ) ..\test.php:30
4 0.0557 3312208 Guzzle\Service\Client->__call( ) ..(null):103
5 0.0557 3312296 Guzzle\Service\Client->getCommand( ) ..(null):93
This is the code I used (straight from the AWS page)
$client = SesClient::factory(array(
'key' => '',
'secret' => '',
'region' => 'us-east-1'
));
$response = $client->send_email(
'no-reply@amazon.com', // Source (aka From)
array('ToAddresses' => array( // Destination (aka To)
'myemail@hotmail.nl'
)),
array( // Message (short form)
'Subject.Data' => 'Email Test ' . time(),
'Body.Text.Data' => 'This is a simple test message ' . time()
)
);
// Success?
var_dump($response->isOK());
UPDATE!!!:
Fixed the issues above, now I got an SSL certificate issue:
Guzzle\Http\Exception\CurlException: [curl] 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [url] https://email.us-east-1.amazonaws.com/ in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 578
Thanks in advance
First of all, it seems that you should include this code for instantiating the client and sending the email within a try-catch block, that will certainly resolve the Catchable fatal error part and allow your code to continue executing.
As far as the getCommand parameter problem, my guess is that there is some issue with your arguments to
send_email()
that are passed down the call stack. Without digging through the SDK I don;t know off the top of my head what arguments are specifically passed togetCommand
, but you have all the information you need there to debug the issue, as you should be able to map how your arguments are passed through each of the calls shown in the stack trace, debugging along the way to verify what is passed to each function is what is expected.The problem with the SSL is because CURL does not bundle CA certs anymore, you'd need to set the proper CA info.
Solution 1 (Changes to PHP.ini):
Set the curl.ca_info options to point to the location of the cacert.pem
Restart Apache
Solution 2 (Set options before each CURL call)
Write the following code:
Source: http://tumblr.wehavefaces.net/post/52114563111/environment-windows-xampp-curl-library
For an answer to the first (now supposedly resolved - HOW?) issue, see AWS SDK Guzzle error when sending email with SES
Please, if you have a solution to an issue, particularly one as arcane as this, POST IT for others to use.