Reputation: 998
The below function should send an SMS when it is executed. Actually I did not work with Oracle for almost more than 8 years and using MySQL. Can some one help me how to execute the below function in Oracle. I have installed Oracle 10g and created this function but do not know how to save it and execute it. sendsms.php
is a page in my server which responsible to take the post from the Oracle function data and send the message.
Create or replace function Send_MSG
(
P_User_Name in varchar2,
P_Password in varchar2,
P_numbers in varchar2,
P_Sender in varchar2,
P_msg in varchar2,
P_dateSend in varchar2 default 0,
P_timeSend in varchar2 default 0,
P_deleteKey in varchar2,
P_msgKey in varchar2
)
Return varchar2 is
Begin
Return 'http://www.mywebsite.com/sendsms.php?mobile='||P_User_Name||'&'||'password='||P_Password||'&'||'numbers='||P_numbers||'&'||'sender='||P_sender||'&'||'msg='||xx_unicode(P_msg)||'&'||'dateSend='||nvl(P_dateSend,0)||'&'||'timeSend='||nvl(P_timeSend,0)||'&'||'msgId='||P_msgKey||'&'||'applicationType=24';
End Send_MSG;
Upvotes: 0
Views: 100
Reputation: 21993
if you want oracle to go to that url and fetch the output from it, then just change your return line to:
return utl_http.request(
'http://www.mywebsite.com/sendsms.php?mobile='||P_User_Name||'&'||'password='||P_Password||'&'||'numbers='||P_numbers||'&'||'sender='||P_sender||'&'||'msg='||xx_unicode(P_msg)||'&'||'dateSend='||nvl(P_dateSend,0)||'&'||'timeSend='||nvl(P_timeSend,0)||'&'||'msgId='||P_msgKey||'&'||'applicationType=24');
p.s. if you need to set a proxy, you need to call
utl_http.set_proxy('your-proxy:port', '');
prior to the return.
Upvotes: 1