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);
--Based on your service provider, the following link format may differ from
--What we have specified below!
UTL_URL.
Escape
(SMS_MSG,
TRUE
);
--UTL_URL.Escape manages escape characters like SPACE between words in a message.
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);
-- Process Request
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
"و فوق كل ذي علم عليم"