Skip to content

Instantly share code, notes, and snippets.

@nadavkav
Created March 10, 2018 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadavkav/968e53d69097acb95369b420a051ab4a to your computer and use it in GitHub Desktop.
Save nadavkav/968e53d69097acb95369b420a051ab4a to your computer and use it in GitHub Desktop.
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