Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
send sms via moodle php to ssl-vp.com smoove.io
<?php
require(__DIR__.'../../config.php');
require_once($CFG->libdir.'/filelib.php');
$endpoint = 'https://ssl-vp.com/rest/v1/Messages?sendNow=true';
$header = array('Content-type: application/json','Authorization: PUT-API-KEY');
$params = array('toMembersByCell' => array('+972 53 333333'),
'body' => 'Hello PeTeLs !!! what\'s going on??? ',
'fromNumber' => '+972 53 3333333');
$curl = new \curl(array('debug' => true));
$curl->setHeader($header);
$response = $curl->post($endpoint, json_encode($params));
$curlerrno = $curl->get_errno();
if (!empty($curlerrno)) {
throw new checker_exception('err_response_curl', 'cURL error '.$curlerrno.': '.$curl->error);
}
$curlinfo = $curl->get_info();
if ($curlinfo['http_code'] != 200) {
throw new checker_exception('err_response_http_code', $curlinfo['http_code']);
}
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment