使用utl_http獲取某個http頁面內容

xsb發表於2010-01-05

set head off
set feed off
set termout off
set serveroutput on
spool d:test.html

DECLARE
req utl_http.req;
resp utl_http.resp;
VALUE VARCHAR2(4000);

[@more@]

BEGIN

req := utl_http.begin_request('');
utl_http.set_header(req, 'Content-Type', 'text/html; charset=gb2312');
resp := utl_http.get_response(req);
dbms_output.enable(1000000);
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;
/
spool off

Ref: http://www.itpub.net/thread-826155-1-1.html

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12402/viewspace-1030291/,如需轉載,請註明出處,否則將追究法律責任。

相關文章