7 Replies Latest reply on Oct 7, 2019 12:41 PM by John Thorton

    Sending Sms From Oracle data base Using Cellular mobile company API

    Ace Mirxa

      Dear experts ,

       

      i want to send sms from oracle to mobile number using 3rd party cellular netowrk's api from 11GR2.

      and want to access this link using plsql procedure

      link "https://telenorcsms.com.pk:27677/corporate_sms2/userProfile.jsp"

       

      if it is possible in oracle using pl sql then kindly give me meaningful solution or any idea.

       

      Thanks in Advance.

       

      here is the code that i am using to access the url.

       

      set define off;

      DECLARE

       

      HTTP_REQ UTL_HTTP.REQ;

      HTTP_RESP UTL_HTTP.RESP;

      URL_TEXT VARCHAR2(32767);

      URL VARCHAR2(2000);

      p_wallet_path varchar2(32767);

      p_wallet_password varchar2(10);

      SMS_MSG VARCHAR2(160) := 'Congratulations! Your database has been configured propoerly for sending SMS through a 3rd party SMS Gateway';

       

      BEGIN

       

      UTL_HTTP.set_wallet('file:D:\Oracle\Middleware\Oracle_FRHome1\wallet1', 'oracle786');

       

      DBMS_OUTPUT.ENABLE(1000000);

       

      url := 'https://telenorcsms.com.pk:27677/corporate_sms2/api/sendsms.jsp?session_id=f6feaeee8fb24e658e5cffb504286f51&to=923XXXXXXX';

       

      HTTP_REQ := UTL_HTTP.BEGIN_REQUEST(URL,'Host','HTTP/1.0');

       

      UTL_HTTP.SET_HEADER(HTTP_REQ, 'User-Agent', 'Internet Explorer/11.0.155');

      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 dbms_output.put_line(sqlerrm);

      END;

      END LOOP;

       

      UTL_HTTP.END_RESPONSE(HTTP_RESP);

      END;