$messages); $payload = \json_encode($body); # Escape for shell usage. $payload = \escapeshellarg($payload); $secret = $this->secret; $protocol = $this->ssl() ? "https://" : "http://"; $host = "api.segment.io"; $path = "/v1/import"; $url = $protocol . $host . $path; $cmd = "curl -u {$secret}: -X POST -H 'Content-Type: application/json'"; $cmd .= " -d " . $payload . " '" . $url . "'"; if (!$this->debug()) { $cmd .= " > /dev/null 2>&1 &"; } \exec($cmd, $output, $exit); if ($exit != 0) { $this->handleError($exit, $output); } return $exit == 0; } }