UTL_HTTP

81 篇文章 0 订阅
22 篇文章 0 订阅

http://psoug.org/reference/utl_http.html

 

http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_http.htm

 

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_http.htm

 

SQL> DECLARE
  2  req utl_http.req;
  3  resp utl_http.resp;
  4  value VARCHAR2(1024);
  5  v_url varchar2(1024);
  6  text VARCHAR2(4000);
  7  name VARCHAR2(1024);
  8  value1 VARCHAR2(1024);
  9  x PLS_INTEGER;
 10  BEGIN
 11  v_url :='http://192.168.110.120:8080/WebTest_1/mo.jsp?destnumber=1062012199@srcnumber=13858088526@content=556@timestamp=20090514154510';
 12  req := utl_http.begin_request(replace(v_url,'@','&'));
 13  utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0');
 14  resp := utl_http.get_response(req);
 15  utl_http.read_text(resp, text, 4000);
 16  dbms_output.put_line('begin  ');
 17  dbms_output.put_line(text);
 18  dbms_output.put_line('end  ');
 19  utl_http.get_transfer_timeout(x);
 20    DBMS_OUTPUT.PUT_LINE('get_transfer_timeout: ' || x);
 21    DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
 22    DBMS_OUTPUT.PUT_LINE('HTTP response reason phrase: ' || resp.reason_phrase);
 23    FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(resp) LOOP
 24      UTL_HTTP.GET_HEADER(resp, i, name, value1);
 25      DBMS_OUTPUT.PUT_LINE(name || ':-:' || value1);
 26    END LOOP;
 27 
 28  LOOP
 29  dbms_output.put_line('begin1  ');
 30  utl_http.read_line(resp, value, TRUE);
 31  dbms_output.put_line('end1  ');
 32  dbms_output.put_line(value);
 33  END LOOP;
 34 
 35  utl_http.end_response(resp);
 36  EXCEPTION
 37  WHEN utl_http.end_of_body THEN
 38  utl_http.end_response(resp);
 39  END;
 40  /
 
begin 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="http://192.168.110.120:8080/WebTest_1/">
   
    <title>My JSP 'mo.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
 
  <body>
    This is my JSP page. <br>
        <br/>
    1062012199<br/>
    13858088526<br/>
    556<br/>
    20090514154510<br/>
   
   
  </body>
</html>

end 
get_transfer_timeout: 60
HTTP response status code: 200
HTTP response reason phrase: OK
Server:-:Apache-Coyote/1.1
Content-Type:-:text/html;charset=GBK
Content-Length:-:864
Date:-:Thu, 12 May 2011 11:19:13 GMT
Connection:-:close
begin1 
 
PL/SQL procedure successfully completed

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

-无-为-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值