SAK }‘ŠÙ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

Oracle PL/SQL •Ò19 - ƒEƒFƒuƒAƒNƒZƒXAUTL_HTTPAUTL_URLAUTL_INADDR

¡UTL_HTTP

  EUTL_HTTP ƒpƒbƒP[ƒW‚ł́AHTTP ƒvƒƒgƒRƒ‹‚ŃEƒFƒuƒT[ƒo‚ɃAƒNƒZƒX‚Å‚«
    ‚éB‚©‚Ȃ胍[ƒŒƒxƒ‹‚È‚±‚Æ‚à‚Å‚«‚éŽd—l‚É‚È‚Á‚Ä‚¢‚éB
    (Oracle8i - 8.1.6 ˆÈ~AOracle9i - 9.0.1 ‚Å‹@”\Šg’£‚ ‚è)

  REQUEST                      URL ‚©‚ç 2000 ƒoƒCƒgŽæ“¾
  REQUEST_PIECES               URL ‚©‚ç 2000 ƒoƒCƒgƒs[ƒXŽæ“¾
  SET_PROXY                    ƒvƒƒLƒVÝ’è
  GET_PROXY                    ƒvƒƒLƒVŽæ“¾
  SET_COOKIE_SUPPORT           Cookie ƒTƒ|[ƒgÝ’è
  GET_COOKIE_SUPPORT           Cookie ƒTƒ|[ƒgŽæ“¾
  SET_FOLLOW_REDIRECT          ƒŠƒ_ƒCƒŒƒNƒgÅ‘å‰ñ”Ý’è
  GET_FOLLOW_REDIRECT          ƒŠƒ_ƒCƒŒƒNƒgÅ‘å‰ñ”Žæ“¾
  SET_BODY_CHARSET             ƒfƒtƒHƒ‹ƒgƒLƒƒƒ‰ƒNƒ^ƒZƒbƒgÝ’è
  GET_BODY_CHARSET             ƒfƒtƒHƒ‹ƒgƒLƒƒƒ‰ƒNƒ^ƒZƒbƒgŽæ“¾
  SET_PERSISTENT_CONN_SUPPORT  ‰i‘±“IÚ‘±Å‘å‰ñ”Ý’è
  GET_PERSISTENT_CONN_SUPPORT  ‰i‘±“IÚ‘±Å‘å‰ñ”Žæ“¾
  SET_RESPONSE_ERROR_CHECK     —áŠOÝ’è
  GET_RESPONSE_ERROR_CHECK     —áŠOÝ’èŽæ“¾
  SET_DETAILED_EXCP_SUPPORT    Ú×—áŠOÝ’è
  GET_DETAILED_EXCP_SUPPORT    Ú×—áŠOÝ’èŽæ“¾
  SET_WALLET                   SSL Œo—R Wallet Ý’è
  SET_TRANSFER_TIMEOUT         ƒ^ƒCƒ€ƒAƒEƒg’lÝ’è
  GET_TRANSFER_TIMEOUT         ƒ^ƒCƒ€ƒAƒEƒg’lŽæ“¾
  BEGIN_REQUEST                HTTP ƒŠƒNƒGƒXƒg
  SET_HEADER                   HTTP ƒwƒbƒ_Ý’è
  SET_AUTHENTICATION           HTTP ”FØÝ’è
  WRITE_TEXT                   HTTP ƒŠƒNƒGƒXƒgƒeƒLƒXƒg‘‚«ž‚Ý
  WRITE_LINE                   HTTP ƒŠƒNƒGƒXƒgƒeƒLƒXƒg 1 s‘‚«ž‚Ý
  WRITE_RAW                    HTTP ƒŠƒNƒGƒXƒgƒeƒLƒXƒg raw ‘‚«ž‚Ý
  END_REQUEST                  HTTP ƒŠƒNƒGƒXƒgI—¹
  GET_RESPONSE                 HTTP ƒŒƒXƒ|ƒ“ƒXŽæ“¾
  GET_HEADER_COUNT             HTTP ƒŒƒXƒ|ƒ“ƒXƒwƒbƒ_”Žæ“¾
  GET_HEADER                   HTTP ƒŒƒXƒ|ƒ“ƒXƒwƒbƒ_Žæ“¾
  GET_HEADER_BY_NAME           HTTP ƒŒƒXƒ|ƒ“ƒX“Á’èƒwƒbƒ_Žæ“¾
  GET_AUTHENTICATION           HTTP ”FØî•ñŽæ“¾
  READ_TEXT                    HTTP ƒŒƒXƒ|ƒ“ƒXƒeƒLƒXƒg“ǂݍž‚Ý
  READ_LINE                    HTTP ƒŒƒXƒ|ƒ“ƒXƒeƒLƒXƒg 1 s“ǂݍž‚Ý
  READ_RAW                     HTTP ƒŒƒXƒ|ƒ“ƒXƒeƒLƒXƒg raw “ǂݍž‚Ý
  END_RESPONSE                 HTTP ƒŒƒXƒ|ƒ“ƒXI—¹
  GET_COOKIE_COUNT             Cookie ”Žæ“¾
  GET_COOKIES                  Cookie Žæ“¾
  ADD_COOKIES                  Cookie ’ljÁ
  CLEAR_COOKIES                Cookie ƒNƒŠƒA
  GET_PERSISTENT_CONN_COUNT    ‰i‘±“IÚ‘±”Žæ“¾
  GET_PERSISTENT_CONNS         ‰i‘±“IÚ‘±Žæ“¾
  CLOSE_PERSISTENT_CONN        ‰i‘±“IÚ‘±ƒNƒ[ƒY
  CLOSE_PERSISTENT_CONNS       ‰i‘±“IÚ‘±ƒNƒ[ƒY
  GET_DETAILED_SQLCODE         —áŠO‚Ì sqlcode Žæ“¾
  GET_DETAILED_SQLERRM         —áŠO‚Ì sqlerrm Žæ“¾

¡SET_PROXY

  EƒvƒƒLƒV‚ÌŽd—lÝ’è‚ðs‚¢‚Ü‚·B
    ŽÀs‚́Abegin_request ‚Ì‘O‚ōs‚¢‚Ü‚·B

  utl_http.set_proxy('proxy.sak-design.com', 'sak.sak-design.com');
                      |                       |_ ƒvƒƒLƒV‚ðŽg—p‚µ‚È‚¢
                      |                          ƒzƒXƒg–¼‹y‚сAƒhƒƒCƒ“
                      |                          (in varchar2)
                      |_ ƒvƒƒLƒVƒzƒXƒg–¼
                         (in varchar2)

¡BEGIN_REQUEST

  EHTTP ƒŠƒNƒGƒXƒg‚𑗐M‚µ‚Ü‚·B

  rq := utl_http.begin_request('http://sak-design/');
  |                            |_ URL
  |                               (in varchar2)
  |_ –ß‚è’l(req)
     HTTP ƒŠƒNƒGƒXƒg

  rq := utl_http.begin_request('http://sak-design/', 'GET', httpver);
  |                            |                     |      |_ HTTP Version
  |                            |                     |         È—ª’l NULL
  |                            |                     |         (in varchar2)
  |                            |                     |_ METHOD
  |                            |                        È—ª’l 'GET'
  |                            |                        (in varchar2)
  |                            |_ URL
  |                               (in varchar2)
  |_ –ß‚è’l(req)
     HTTP ƒŠƒNƒGƒXƒg

¡SET_HEADER

  EHTTP ƒŠƒNƒGƒXƒgƒwƒbƒ_‚ðÝ’肵‚Ü‚·B

  utl_http.set_header(rq, 'User-Agent', 'Mozilla/4.0');
                      |   |             |_ HTTP ƒŠƒNƒGƒXƒgƒwƒbƒ_’l
                      |   |                (in varchar2)
                      |   |_ HTTP ƒŠƒNƒGƒXƒgƒwƒbƒ_–¼
                      |      (in varchar2)
                      |_ HTTP ƒŠƒNƒGƒXƒg
                         (in out req)

¡GET_RESPONSE

  EHTTP ƒŒƒXƒ|ƒ“ƒX‚ðŽæ“¾‚µ‚Ü‚·B

  rs := utl_http.get_response(rq);
  |                           |_ HTTP ƒŠƒNƒGƒXƒg
  |                              (in out req)
  |_ –ß‚è’l(resp)
     HTTP ƒŒƒ“ƒ|ƒ“ƒX

¡READ_LINE

  EHTTP ƒŒƒXƒ|ƒ“ƒX‚©‚çA1 sƒf[ƒ^‚ðŽæ“¾‚µ‚Ü‚·B
    Žæ“¾ƒf[ƒ^‚ª‚È‚¢ê‡AUTL_HTTP.END_OF_BODY —áŠO‚ª”­¶‚µ‚Ü‚·B

  utl_http.read_line(rs, rec, true);
                     |   |    |_ TRUE   ‰üs•¶Žšíœ
                     |   |       FALSE  ‰üs•¶Žš•t‚«
                     |   |       È—ª’l FALSE
                     |   |       (in boolean)
                     |   |_ HTTP ƒ\[ƒX 1 sƒoƒbƒtƒ@
                     |      (out varchar2)
                     |_ HTTP ƒŒƒ“ƒ|ƒ“ƒX
                        (in out resp)

¡END_RESPONSE

  EHTTP ƒŒƒXƒ|ƒ“ƒX‚ðI—¹‚µ‚Ü‚·B

  utl_http.end_response(rs);
                        |_ HTTP ƒŒƒ“ƒ|ƒ“ƒX
                           (in out resp)

¡HTML Žæ“¾

  EŽŸ‚̃Tƒ“ƒvƒ‹‚́AƒŠƒ‚[ƒg IP ƒAƒhƒŒƒXAƒŠƒ‚[ƒgƒzƒXƒg–¼‚ð•\Ž¦‚·‚é‚Æ‹¤
    ‚ÉŽw’èƒEƒFƒuƒT[ƒo‚ɃAƒNƒZƒX‚µ‚āAHTML ƒ\[ƒX‚ðŽæ“¾‚·‚éB

set serveroutput on;

declare

  url  varchar2(200) := 'http://sak-design/';
  rq   utl_http.req;
  rs   utl_http.resp;
  rec  varchar2(2000);
  fno  utl_file.file_type;
  ip   varchar2(15);
  rh   varchar2(200);

begin

-- ƒŠƒ‚[ƒg IP ƒAƒhƒŒƒXAƒŠƒ‚[ƒgƒzƒXƒg–¼Žæ“¾
  ip := utl_inaddr.get_host_address();
  rh := utl_inaddr.get_host_name(ip);
  dbms_output.put_line('IP = ' || ip);
  dbms_output.put_line('ƒŠƒ‚[ƒgƒzƒXƒg–¼ = ' || rh);

-- HTML Žæ“¾
  rq := utl_http.begin_request(utl_url.escape(url));
  utl_http.set_header(rq, 'User-Agent', 'Mozilla/4.0');
  rs := utl_http.get_response(rq);
  fno := utl_file.fopen('g:\tmp', 'test.htm', 'W', 2002);
  loop
    utl_http.read_line(rs, rec, true);
    utl_file.put_line(fno, rec);
  end loop;
  utl_http.end_response(rs);
  utl_file.fclose(fno);

exception
  when UTL_HTTP.END_OF_BODY then  -- HTML Žæ“¾ AT END
    utl_http.end_response(rs);
    utl_file.fclose(fno);

end;
/

¡UTL_HTTP —áŠO

  REQUEST_FAILED               29273  —v‹ŽÀsŽ¸”s
  BAD_ARGUMENT                 29261  ˆø”ƒGƒ‰[
  BAD_URL                      29262  URL ƒGƒ‰[
  PROTOCOL_ERROR               29263  HTTP ƒvƒƒgƒRƒ‹ƒGƒ‰[
  UNKNOWN_SCHEME               29264  URL ƒXƒL[ƒ€•s–¾
  HEADER_NOT_FOUND             29265  ƒwƒbƒ_[‚ªŒ©‚‚©‚ç‚È‚¢
  END_OF_BODY                  29266  HTTP ƒŒƒXƒ|ƒ“ƒXI’[
  ILLEGAL_CALL                 29267  UTL_HTTP ƒR[ƒ‹ƒGƒ‰[
  HTTP_CLIENT_ERROR            29268  ƒŒƒXƒ|ƒ“ƒXƒNƒ‰ƒCƒAƒ“ƒgƒGƒ‰[
  HTTP_SERVER_ERROR            29269  ƒŒƒXƒ|ƒ“ƒXƒT[ƒo[ƒGƒ‰[
  TOO_MANY_REQUESTS            29270  ƒI[ƒvƒ“—v‹A‰ž“š‚ª‘½‚·‚¬‚é
  PARTIAL_MULTIBYTE_EXCEPTION  29275  ƒ}ƒ‹ƒ`ƒoƒCƒgƒLƒƒƒ‰ƒNƒ^ŒŸo
  TRANSFER_TIMEOUT             29276  ƒ^ƒCƒ€ƒAƒEƒg”­¶

¡UTL_URL

  EUTL_URL ƒpƒbƒP[ƒW‚́AURL ’†‚ÉŠÜ‚Ü‚ê‚éƒpƒ‰ƒƒ^‚È‚Ç‚Ì‹ó”’‚âƒJƒ“ƒ}‚ð
    ƒGƒXƒP[ƒv•¶Žš‚É•ÏŠ·‚·‚éê‡‚ÉŽg—p‚·‚éB
    (Oracle9i - 9.0.1 ˆÈ~)

  ESCAPE    ƒGƒXƒP[ƒv•¶Žš‚ðŠÜ‚Þ URL ‚É•ÏŠ·
  UNESCAPE  ƒGƒXƒP[ƒv•¶Žš‚ðŠÜ‚Þ URL ‚ðƒIƒŠƒWƒiƒ‹‚É•ÏŠ·

  esurl := utl_url.escape(url);
  |                       |_ ƒIƒŠƒWƒiƒ‹ URL (in varchar2)
  |_ –ß‚è’l(varchar2)
     ƒGƒXƒP[ƒv•¶Žš•ÏŠ· URL

  url := utl_url.unescape(esurl);
  |                       |_ ƒGƒXƒP[ƒv•¶Žš•ÏŠ· URL (in varchar2)
  |_ –ß‚è’l(varchar2)
     ƒIƒŠƒWƒiƒ‹ URL

¡UTL_INADDR

  EUTL_INADDR ƒpƒbƒP[ƒW‚́AƒŠƒ‚[ƒgƒzƒXƒgî•ñ‚ðŽæ“¾‚·‚éê‡‚ÉŽg—p‚·‚éB
    (Oracle8i - 8.1.6 ˆÈ~)

  GET_HOST_ADDRESS  ƒŠƒ‚[ƒgƒzƒXƒg IP ƒAƒhƒŒƒXŽæ“¾
  GET_HOST_NAME     ƒŠƒ‚[ƒgƒzƒXƒg–¼Žæ“¾

  ip := utl_inaddr.get_host_address();
  |                                 |_ ƒŠƒ‚[ƒgƒzƒXƒg–¼‚ðŽw’è‚·‚é‚Æ
  |                                    ŠY“–‚·‚é IP ‚ª•Ô‚éB
  |                                    È—ª‰Â (in varchar2)
  |_ –ß‚è’l(varchar2)
     IP ƒAƒhƒŒƒX

  rh := utl_inaddr.get_host_name(ip);
  |                              |_ IP ƒAƒhƒŒƒX‚ðŽw’è‚·‚é‚Æ
  |                                 ŠY“–‚·‚郊ƒ‚[ƒgƒzƒXƒg–¼‚ª•Ô‚éB
  |                                 È—ª‰Â (in varchar2)
  |_ –ß‚è’l(varchar2)
     ƒŠƒ‚[ƒgƒzƒXƒg–¼

¡Oracle PL/SQL •ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ



Copyright (C) 1999-2017 Y.SAK