private function SendinblueMailin::doRequestDirect in SendinBlue 7
Do CURL request directly into sendinblue.
Parameters
array $data: A data of curl request.
Return value
array An associate array with respond data.
1 call to SendinblueMailin::doRequestDirect()
- SendinblueMailin::partnerDrupal in includes/
sendinblue.mailin.php - Add the Partner's name in sendinblue.
File
- includes/
sendinblue.mailin.php, line 82 - Rest class file.
Class
- SendinblueMailin
- Sendinblue REST client.
Code
private 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;
}