public function SendinblueHttpClient::doRequestDirect in SendinBlue 7.2
Do CURL request directly into sendinblue.
Parameters
array $data: A data of curl request.
Return value
array An associate array with respond data.
File
- includes/
Http/ SendinblueHttpClient.php, line 120
Class
- SendinblueHttpClient
- Sendinblue REST client.
Code
public function doRequestDirect($data) {
if (!function_exists('curl_init')) {
$msg = 'SendinBlue requires CURL module';
watchdog('sendinblue', $msg, NULL, WATCHDOG_ERROR);
return NULL;
}
$url = 'http://ws.mailin.fr/';
$ch = curl_init();
$paramData = '';
$data['source'] = 'Drupal';
if (is_array($data)) {
foreach ($data as $key => $value) {
$paramData .= $key . '=' . urlencode($value) . '&';
}
}
else {
$paramData = $data;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Expect:',
));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $paramData);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}