[转]:在oracle中通过utl_http获得指定网页内容,支持中文
2012-08-28 18:07
309 查看
直接使用oracle中提供的包来实现读取指定页面的内容。
例如:
SET serveroutput ON SIZE 40000
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1000);
BEGIN
req := utl_http.begin_request('http://www.5ienet.com/online.asp');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
怎么样,是不是结果已经出来了,哎,不对怎么中文字符都显示成了乱码,呵呵,别急,将下面这行代码加在resp:=那行之前再试试。
utl_http.set_header(req, 'Content-Type', 'text/html; charset=gb2312');
例如:
SET serveroutput ON SIZE 40000
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1000);
BEGIN
req := utl_http.begin_request('http://www.5ienet.com/online.asp');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
怎么样,是不是结果已经出来了,哎,不对怎么中文字符都显示成了乱码,呵呵,别急,将下面这行代码加在resp:=那行之前再试试。
utl_http.set_header(req, 'Content-Type', 'text/html; charset=gb2312');
相关文章推荐
- 在oracle中通过utl_http获得指定网页内容
- oracle通过utl_http获得指定网页的内容
- Oracle 通过UTL_HTTP 发送http请求并处理发送内容中包含空格和特殊字符的问题
- Oracle 通过UTL_HTTP 发送http请求并处理发送内容中包含空格和特殊字符的问题
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- Mybatis Generator的model生成中文注释,支持oracle和mysql(通过实现CommentGenerator接口的方法来实现)
- Oracle 存储过程中发送邮件,并支持用户验证、中文标题和内容
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容
- 京东价格监控软件开发技术探讨二:通过HttpWebRequest获取指定网页数据
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- [Python]网络爬虫(二):利用urllib通过指定的URL抓取网页内容
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- 使用HttpClient获得网页内容
- Mybatis Generator的model生成中文注释,支持oracle和mysql(通过实现CommentGenerator接口的方法来实现)
- [Python]网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- 网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容