oserl as a black box in another OTP applicati

phicarre
2009-08-17
2013-05-21
  • phicarre
    phicarre
    2009-08-17

    Hello,
    I would like to use oserl as a "black box" for sending sms from an OTP application. My host provider gave me a PHP script for sending sms:

    function sendSms($phone, $message) {
            $sock=fsockopen("xxx.com", 80);

            if ($sock) {
                $xml="<sms><key>0TuiKQFLD5ekRzh...</key><phone>" . str_replace(array("<", ">", "&"), array("&lt;", "&gt;", "&amp;"), $phone) . "</phone><message>" . str_replace(array("<", ">", "&"), array("&lt;", "&gt;", "&amp;"), $message) . "</message></sms>";
                $data="xml=" . urlencode($xml);
                fwrite($sock, "POST /sms/xmlrequest.php HTTP/1.0\r\nHost:xxx.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: " . strlen($data) . "\r\n\r\n" . $data);
                $answer=trim(fgets($sock, 1024));

                while (!empty($answer)) {
                    $answer=trim(fgets($sock, 1024));
                }

                $answer=trim(fgets($sock, 1024));
                fclose($sock);
                return $answer=="ok";
            }

            return false;
        }

    oserl is a great but big application for me. Could you tell me which module(s), function(s) I should/shall modify to send sms according to the method described in the script.
    But first of all, does oserl an open source application ?
    Thank you for your reply

     
    • Hi,

      OSERL is a SMPP implementation.  In your particular case, it seems that you are using a SMS provider that is offering you a XML API over HTTP.  You don't need OSERL, you are on a higher level of abstraction.  Simply use inets or whatever suits you better to issue your http post.  That is all you need.

      Kind regards,

      Enrique