private function writeHttp($data) { if (!$this->httpConnection) { $this->connectHttp(); } curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '[' . $data . ']'); curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen('[' . $data . ']'))); Curl\Util::execute($ch, 5, false); }
private function writeHttp($data) { if (!$this->httpConnection) { $this->connectHttp(); } curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, $data); curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . config('dblogger.api_key'), 'Content-Type: application/json', 'Content-Length: ' . strlen($data))); Util::execute($this->httpConnection, 5, false); }
/** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { $slackbotUrl = sprintf('https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', $this->slackTeam, $this->token, $this->channel); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $slackbotUrl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); Curl\Util::execute($ch); }
/** * {@inheritdoc} */ public function write(array $record) { $postData = array("value1" => $record["channel"], "value2" => $record["level_name"], "value3" => $record["message"]); $postString = json_encode($postData); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->_eventName . "/with/key/" . $this->_secretKey); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); Curl\Util::execute($ch); }
/** * {@inheritdoc} */ protected function send($content, array $records) { $message = clone $this->message; $message->setBody($content); $message->setDate(time()); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('key' => $this->apiKey, 'raw_message' => (string) $message, 'async' => false))); Curl\Util::execute($ch); }
protected function makeRequest($curlPostData) { $data = json_encode($curlPostData); $headers = array('Content-Type: application/json', 'Content-Length: ' . strlen($data)); $curl = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiURL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); Curl\Util::execute($curl); }
/** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { $postData = $this->slackRecord->getSlackData($record); $postString = json_encode($postData); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->webhookUrl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (defined('CURLOPT_SAFE_UPLOAD')) { curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); } curl_setopt($ch, CURLOPT_POSTFIELDS, array('payload' => $postString)); Curl\Util::execute($ch); }
protected function send($data, $endpoint) { $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token); $headers = array('Content-Type: application/json'); if (!empty($this->tag)) { $headers[] = 'X-LOGGLY-TAG: ' . implode(',', $this->tag); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); Curl\Util::execute($ch); }
/** * {@inheritdoc} */ protected function send($content, array $records) { $message = []; $message['api_user'] = $this->apiUser; $message['api_key'] = $this->apiKey; $message['from'] = $this->from; foreach ($this->to as $recipient) { $message['to[]'] = $recipient; } $message['subject'] = $this->subject; $message['date'] = date('r'); if ($this->isHtmlBody($content)) { $message['html'] = $content; } else { $message['text'] = $content; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.sendgrid.com/api/mail.send.json'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($message)); Curl\Util::execute($ch, 2); }