I'm using the example from https://github.com/SparkPost/php-sparkpost#send-an-email-using-the-transmissions-endpoint
with the asynch promise here: https://github.com/SparkPost/php-sparkpost#then-asynchronous
Everything is installed properly using Composer. If I use $response = $promise->wait(); email is sent but not $promise->then(function(){}, function(){})
I'm running php script from command line, asynch option set to true
/// this works:
try {
$response = $promise->wait();
echo $response->getStatusCode()."\n";
print_r($response->getBody())."\n";
} catch (\Exception $e) {
echo $e->getCode()."\n";
echo $e->getMessage()."\n";
}
// but this doesn't
$promise->then(
// Success callback
function ($response) {
echo $response->getStatusCode()."\n";
print_r($response->getBody())."\n";
},
// Failure callback
function (Exception $e) {
echo $e->getCode()."\n";
echo $e->getMessage()."\n";
}
);