?
Solved

HTTP request from PLSQL

Posted on 2010-04-04
1
Medium Priority
?
471 Views
Last Modified: 2013-12-07
I need help in writing a PLSQL procedure where one can send any txt message to a HTTP URL like:
http://xxx.xxx.xxx.xx:<<PORT>>/poctest/servlet/testpoc

I want to use the FUNCTION begin_request from UTL_HTTP package.

Can any one please help me in this ?
0
Comment
Question by:Umesh
1 Comment
 
LVL 2

Accepted Solution

by:
peteodonnell earned 2000 total points
ID: 30644931
create procedure sendtxttourl (p_url varchar2,
                               p_txt varchar2)
is

  req   utl_http.req;
  resp  utl_http.resp;
  value VARCHAR2(1024);

begin
 
  req := utl_http.begin_request(p_url || '?txt=' || p_txt);
  utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0');
  resp := utl_http.get_response(req);
  loop
    utl_http.read_line(resp, value, TRUE);
    dbms_output.put_line(value);
  end loop;
  utl_http.end_response(resp);
exception
  when utl_http.end_of_body then
    utl_http.end_response(resp);
end;
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question