使用plsq发送post或get请求,开始发送中文时有乱码,网上搜了半天,终于找到解决办法,关键点见红色字体部分,记录以备忘:
set serveroutput on;
exec dbms_output.enable(1000000000);
set escape '\'
DECLARE
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
value VARCHAR2(1024); -- URL to post to
v_url VARCHAR2(200) := 'http://ip:port/xxx';
-- Post Parameters
v_param VARCHAR2(500) := 'para1=xxx\?2=xxxx\?3=xxxx';
v_param_length NUMBER := LENGTHB(v_param);
BEGIN
-- Set up proxy servers if required
-- UTL_HTTP.SET_PROXY('proxy.my-company.com', 'corp.my-company.com');
req := UTL_HTTP.BEGIN_REQUEST (url=> v_url, method => 'POST');
-- UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0
set serveroutput on;
exec dbms_output.enable(1000000000);
set escape '\'
DECLARE
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
value VARCHAR2(1024); -- URL to post to
v_url VARCHAR2(200) := 'http://ip:port/xxx';
-- Post Parameters
v_param VARCHAR2(500) := 'para1=xxx\?2=xxxx\?3=xxxx';
v_param_length NUMBER := LENGTHB(v_param);
BEGIN
-- Set up proxy servers if required
-- UTL_HTTP.SET_PROXY('proxy.my-company.com', 'corp.my-company.com');
req := UTL_HTTP.BEGIN_REQUEST (url=> v_url, method => 'POST');
-- UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0