|
比如,
包 就像 面向对象的类
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
BEGIN
utl_http.set_proxy('proxy.it.my-company.com', 'my-company.com'); ---设置代理
req := utl_http.begin_request('http://www-hr.corp.my-company.com'); -- 请求网页
utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0'); --设置头信息
resp := utl_http.get_response(req); --获取http响应对象
LOOP
utl_http.read_line(resp, value, TRUE); --读取内容
dbms_output.put_line(value); --自己处理逻辑
END LOOP;
utl_http.end_response(resp); --结束,释放http响应对象
EXCEPTION -- 异常处理
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END; |
|