curl - Sendgrid PHP Use of undefined constant CURL_SSLVERSION_TLSv1_2 -
i'm using sendgrid api send email message on http via php. code:
<?php $url = 'https://api.sendgrid.com/'; $user = 'user'; $pass = 'password'; $params = array( 'api_user' => $user, 'api_key' => $pass, 'to' => 'target', 'subject' => 'kami menanti anda', 'from' => 'noreply@kompetisiindonesia.com', ); $params['html'] = 'html message'; $params['text'] = $params['html']; $request = $url.'api/mail.send.json'; // generate curl request $session = curl_init($request); // tell curl use http post curl_setopt ($session, curlopt_post, true); // tell curl body of post curl_setopt ($session, curlopt_postfields, $params); // tell curl not return headers, return response curl_setopt($session, curlopt_header, false); // tell php not use sslv3 (instead opting tls) curl_setopt($session, curlopt_sslversion, curl_sslversion_tlsv1_2); curl_setopt($session, curlopt_returntransfer, true); // obtain response $response = curl_exec($session); curl_close($session); // print out print_r($response);
but error message:
notice: use of undefined constant curl_sslversion_tlsv1_2 - assumed 'curl_sslversion_tlsv1_2' in /opt/lampp/htdocs/oprek/sendgrid/sendviahttp.php on line 28
does know what's happening?
it looks might have outdated build of curl installed on machine.
curl_sslversion_tlsv1_2 (integer) available since php 5.5.19 , 5.6.3
Comments
Post a Comment