I'm migrating from Laravel 8 to Laravel 8 + Octane / Swoole. All works fine, but php://input always are empty. Also, I check $_POST and $_SERVER values.
file_get_contents('php://input') is used by AWS SNS Message Validator.
Any alterantive to read php://input?
echo "php://input: ".file_get_contents('php://input');
$ curl -i -X POST --data "dataaaa" https://example.com/aws/sns/webhook
php://input: dataaaa
$ curl -i -X POST --data "dataaaa" https://example.com/aws/sns/webhook
php://input:
php://input are not available on Swoole. Always are the same running process.
use Psr\Http\Message\RequestInterface;
public function sesSubscriptionWebhook(RequestInterface $request)
{
// $input = file_get_contents('php://input'); // dont work on swoole
$input = $request->getBody();
}
Of course, with octane, symfony/psr-http-message-bridge and nyholm/psr7 are required for Laravel PSR-7 requests.
Also, if your problem is related with AWS SES, you need to change Message::fromRawPostData() to Message::fromPsrRequest($request).