Here's how to send sms message from Oracle application.
Explain:
Say we are subscribed to msegat.com service with the following credentials:
User Name : OMAR
Password : 123
User Sender : ThreeM (
you got it from your sms site)Text we'll send : My_Test_Message
Phone we'll send message to : 966123456789
Here's how the code will run:
/*Start of SMS code*/
SET serveroutput ON
SET Define OFF
DECLARE
HTTP_REQ UTL_HTTP.REQ;
HTTP_RESP UTL_HTTP.RESP;
URL_TEXT VARCHAR2(32767);
URL VARCHAR2(2000);
SMS_MSG VARCHAR2(160) := 'Congratulations! Your database has been configured propoerly for sending SMS through a 3rd party SMS Gateway';
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
UTL_URL.Escape(SMS_MSG,TRUE);
HTTP_REQ := UTL_HTTP.BEGIN_REQUEST(URL);
UTL_HTTP.SET_HEADER(HTTP_REQ, 'User-Agent', 'Mozilla/4.0');
HTTP_RESP := UTL_HTTP.GET_RESPONSE(HTTP_REQ);
LOOP
BEGIN
URL_TEXT := null;
UTL_HTTP.READ_LINE(HTTP_RESP, URL_TEXT, TRUE);
DBMS_OUTPUT.PUT_LINE(URL_TEXT);
EXCEPTION
WHEN OTHERS THEN EXIT;
END;
END LOOP;
UTL_HTTP.END_RESPONSE(HTTP_RESP);
END;
/*End of SMS code*/
If you got an error , you can remove :
SET serveroutput ON
SET Define OFF
"و فوق كل ذي علم عليم"