首页 > IT基础架构 > 网络安全 > 使用utl_http获取某个http页面内容
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);
BEGIN
req := utl_http.begin_request('http://www.5ienet.com/online.asp');
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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12402/viewspace-1030291/ ,如需转载,请注明出处,否则将追究法律责任。