Got it! Trick was the formatting of the $data variable.
// Send Data to HEC with PHP
<?php
$data = "{\"event\":\"testing\",\"sourcetype\": \"st\"}";
$ch = curl_init("https://10.x.x.x:8088/services/collector/event");
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "x:cbmytoen");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
... View more