Skip to content

Commit 23326c4

Browse files
committed
Updating curl dispatcher
1 parent 6b94412 commit 23326c4

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/Optimizely/Event/Dispatcher/CurlEventDispatcher.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,13 @@ class CurlEventDispatcher implements EventDispatcherInterface
2828
{
2929
public function dispatchEvent(LogEvent $event)
3030
{
31-
$curl = curl_init();
32-
$options = [
33-
CURLOPT_URL => $event->getUrl(),
34-
CURLOPT_HTTPHEADER => $event->getHeaders(),
35-
CURLOPT_POSTFIELDS => http_build_query($event->getParams()),
36-
CURLOPT_POST => 1,
37-
CURLOPT_RETURNTRANSFER => true,
38-
CURLOPT_CONNECTTIMEOUT_MS => 1
39-
];
40-
41-
curl_setopt_array($curl, $options);
42-
curl_exec($curl);
43-
curl_close($curl);
31+
$cmd = "curl";
32+
$cmd.= " -X ".$event->getHttpVerb();
33+
foreach($event->getHeaders() as $type => $value) {
34+
$cmd.= " -H '".$type.": ".$value."'";
35+
}
36+
$cmd.= " -d '".json_encode($event->getParams())."'";
37+
$cmd.= " '".$event->getUrl()."' > /dev/null 2>&1 &";
38+
exec($cmd);
4439
}
4540
}

0 commit comments

Comments
 (0)