Home » SQL & PL/SQL » SQL & PL/SQL » utl_http.begin_request (R12,10g)
- icon4.gif  utl_http.begin_request [message #492995] Fri, 04 February 2011 03:41 Go to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
hi
I am trying to send sms by using www.clickatell.com

i am passing URL to 'ult_HTTP.begin_request'

as URL contain 2 time HTTP and some of special characters it not correctly execute
the code is as follow:
DECLARE
 req   utl_http.req;
 resp  utl_http.resp;
 value VARCHAR2(1024);
 v_url varchar2(1000);
BEGIN

 --utl_http.set_proxy('proxy.my-company.com', 'corp.my-company.com');
v_url:='http://api.clickatell.com/http/sendmsg''&''api_id=xxx''&''user=xxx''@''xxx.com''&''password=LokeshKumar''&''to=xxxxxxxxxx''&''text=message';

 req := utl_http.begin_request
 (url => v_url,
    method => 'POST');
 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;


the output as:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /'&amp;'http/sendmsg'&amp;'api_id=xxxx'&amp;'user=xxxx'@'xxxx.com'&amp;'password=xxxx'&amp;'to=xxxxx'&amp;'text=message was not found on this server.</p>
<hr>
<address>Apache/2.0.52 (Red Hat) Server at api.clickatell.com Port 80</address>
</body></html>

how to pass url to begin_request which contain http 2 times and special characters........????????

please helppppppppp
- Re: utl_http.begin_request [message #493052 is a reply to message #492995] Fri, 04 February 2011 07:26 Go to previous message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
1:
Output the v_url variable, and compare it to the URL you open in your browser.

Make the two match completely.

2:
You use POST, but you assemble the URL like you would use GET.

Either use GET, or if you use POST you would have to add the parameters with UTL_HTTP.WRITE_TEXT.

Documentation and Examples

[Updated on: Fri, 04 February 2011 07:26]

Report message to a moderator

Previous Topic: Oracle query
Next Topic: Regarding AUTHID DEFINER
Goto Forum:
  


Current Time: Wed May 21 05:09:40 CDT 2025