转 使用utl_http获取某个http页面内容

Posted feiyun8616的作坊 (半个程序员and dba)

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了转 使用utl_http获取某个http页面内容相关的知识,希望对你有一定的参考价值。

 

使用utl_http获取某个http页面内容

首先确认浏览器可以访问IE ,如果不能访问,
vmware 查看 虚拟机 网络适配器 网络连接模式 为NAT
vmware 查看 编辑 虚拟网络编辑器 VMNET0 桥接模式 自动


SQL> select utl_http.request(‘http://www.SINA.com‘) from dual;
select utl_http.request(‘http://www.SINA.com‘) from dual
*
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1720
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at line 1

 

sys:
BEGIN
dbms_network_acl_admin.create_acl(acl => ‘db2.xml‘,
DESCRIPTION => ‘Normal Access‘,
principal => ‘CONNECT‘,
is_grant => TRUE,
PRIVILEGE => ‘connect‘,
start_date => NULL,
end_date => NULL);
END;
/
commit;

SELECT any_path
FROM resource_view
WHERE any_path like ‘/sys/acls/%.xml‘;

 


begin
dbms_network_acl_admin.add_privilege(acl => ‘db2.xml‘,
principal => ‘PENG‘,
is_grant => TRUE,
privilege => ‘connect‘,
start_date => null,
end_date => null);
END;
/

commit;

 

begin
dbms_network_acl_admin.assign_acl(acl => ‘db2.xml‘,
host => ‘www.sina.com‘,
lower_port => 80,
upper_port => NULL);
end;
/

begin
dbms_network_acl_admin.assign_acl(acl => ‘db2.xml‘,
host => ‘www.sina.com‘,
lower_port => NULL,
upper_port => NULL);
end;
/

begin
dbms_network_acl_admin.assign_acl(acl => ‘db2.xml‘,
host => ‘www.sina.com‘
);
end;
/
commit;

select utl_http.request(‘http://www.sina.com‘) from dual;

select utl_http.request(‘http://www.SINA.com‘) from dual;

 

#######sample
sys:

BEGIN
dbms_network_acl_admin.create_acl(acl => ‘SMTP.xml‘,
DESCRIPTION => ‘Normal Access‘,
principal => ‘CONNECT‘,
is_grant => TRUE,
PRIVILEGE => ‘connect‘,
start_date => NULL,
end_date => NULL);
END;
/

commit;

BEGIN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => ‘SMTP.xml‘,
principal => ‘PENG‘,
is_grant => true,
privilege => ‘resolve‘);
END;
/
commit;

BEGIN
dbms_network_acl_admin.assign_acl (acl => ‘SMTP.xml‘,
host => ‘*‘,
lower_port => 1,
upper_port => 9999);
END;
/
commit;

commit;


select utl_http.request(‘http://www.SINA.com‘) from dual;

SELECT acl,
principal,
privilege,
is_grant,
TO_CHAR(start_date, ‘DD-MON-YYYY‘) AS start_date,
TO_CHAR(end_date, ‘DD-MON-YYYY‘) AS end_date
FROM dba_network_acl_privileges;


select host, lower_port, upper_port, acl, aclid from dba_network_acls;

select utl_http.request(‘http://www.5ienet.com‘) from dual;
select utl_http.request(‘http://www.sina.com‘) from dual;

select utl_http.request(‘http://bsy.sz.bendibao.com‘) from dual;

 


###########new error
SQL> select utl_http.request(‘http://www.sina.com‘) from dual;
select utl_http.request(‘http://www.sina.com‘) from dual
*
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1720
ORA-29024: Certificate validation failure
ORA-06512: at line 1

 

 

###############
https://blog.csdn.net/indexman/article/details/17048573
https://blog.csdn.net/indexman/article/details/17048677

https://blog.csdn.net/x6_9x/article/details/79240581

以上是关于转 使用utl_http获取某个http页面内容的主要内容,如果未能解决你的问题,请参考以下文章

PL/SQL UTL_HTTP 发送多个原始数据

对于使用 Oracle pl sql 的 http 请求,是不是有替代 utl_http 包的方法?

确定需要哪个证书才能使用 Oracle utl_http 执行 https 发布

Oracle 12c UTL_HTTP Cookie 值长度大于 1024

使用 ngixx 的 Oracle UTL_HTTP 错误请求

记一次使用utl_http方法调用接口,报字符或值错误