declare URL varchar2 (2000); req utl_http.req; resp utl_http.resp; value varchar2 (1000); region varchar2 (50 ); begin URL: = 'HTTP: // www.youdao.com/smartresult-xml/search.s? Type = IP \ & Q = 25.238.158.9 '; Req: = utl_http.begin_request (URL); resp: = utl_http.get_response (req); loop utl_http.read_line (resp, value, true ); if instr (value, '
')> 0 then dbms_output.put_line ('site reply '| value); If instr (value, '')> 0 then region: = substr (value, instr (value, '>', 1) + 1, instr (value, '', 2)-instr (value, '>', 2) -1); else region: = substr (value, instr (value, '>', 1) + 1, instr (value, '<', 2)-instr (value, '>', 2)-1); end if; If region = ''then dbms_output.put_line ('unknown address'); else dbms_output.put_line (region); end if; end loop; utl_http.end_response (RESP); Exception when utl_http.end_of_body then utl_http.end_response (RESP); end;/
Note: Run with DBA