Oracle UTL_HTTP


Oracle 中可以通過包 UTL_HTTP 來獲取訪問 HTTP 的能力.

declare
  req  UTL_HTTP.REQ;
  resp UTL_HTTP.RESP;
  val  varchar2(32767);
begin
  req := UTL_HTTP.BEGIN_REQUEST('http://www.oracle.com');
  utl_http.set_header(req, 'Content-Type', 'text/html; charset=utf-8');
  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;

還可以直接在 select 中使用請求函數

select utl_http.request('http://www.sohu.com') from dual;

參考


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM