ORACLE利用UTL_HTTP包提供了訪問HTTP的工具。
下面這段代碼是網上找的,可以直接在plsql中運行。
declare
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
val varchar2(32767);
begin
req := UTL_HTTP.BEGIN_REQUEST('http://www.sohu.com');
utl_http.set_header(req, 'Content-Type', 'text/html; charset=utf-8');--add this
resp := UTL_HTTP.GET_RESPONSE(req);
utl_http.read_line(resp, val, true);
utl_http.end_response(resp);
dbms_output.put_line(val);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
end;
如果只是想調用某個url,可以用下面的語句
select utl_http.request('http://www.sohu.com') from dual
以上內容沒有深究,有空再研究,先記錄下來