<?php

function send_sms($recepient, $sms_body) {
    $sms_body = html_entity_decode($sms_body);
    $sms = new SMS();
    $info = $sms->send($recepient, $sms_body);

    $response['items'] = $info;
    $response['incomplete_results'] = FALSE;
    $response['total_count'] = 1;

    $myfile = fopen("sms_log.txt", "w");
    $txt = "GET : " . $_SERVER['QUERY_STRING'] . "\n";
    $txt .= "RECEPIENT : " . $_GET["recepient"] . "\n";
    $txt .= "BODY : " . $_GET["body"] . "\n";
    $txt .= "SMS RESPONSE : " . json_encode($response);
    fwrite($myfile, $txt);
    api_success_response(json_encode($response));
}
