I\'m trying to send a fire-and-forget request from PHP to my websocket aws api gateway.
I\'ve set up an action called \"sendmessage\".
This is the code I\'m
I would recommend using the cURL extension for PHP. The cURL lib maintains a pool of persistent connections by default.
'sendmessage',
'data' => 'test',
);
$payload = json_encode($post_data_array);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $proto.'://'.$host.$path);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload),
'Connection: Keep-Alive',
'Keep-Alive: 300',
)
);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);