Created
March 10, 2018 14:42
-
-
Save nadavkav/968e53d69097acb95369b420a051ab4a to your computer and use it in GitHub Desktop.
send sms via moodle php to ssl-vp.com smoove.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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