【发布时间】:2020-09-19 00:58:27
【问题描述】:
我有一个如下所示的 cURL 命令:
curl --insecure -X POST https://www.example.com -H 'accept-encoding: gzip,deflate' -H 'cache-control: no-cache' -H 'content-type: application/x-www-form-urlencoded' --data "request_type=secure&scope=global&user_id=temp&password=temppass"
我不确定,我需要如何从 PL/SQL 过程中调用此 POST 请求。
尤其是我不知道如何传递 --data 参数。
DECLARE
http_request UTL_HTTP.req;
http_response UTL_HTTP.resp;
return_text VARCHAR2(2000);
BEGIN
http_request := UTL_HTTP.begin_request('https://www.example.com/path/sub_path');
UTL_HTTP.set_header(http_request, 'accept-encoding', 'gzip,deflate');
UTL_HTTP.set_header(http_request, 'cache-control', 'no-cache');
UTL_HTTP.set_header(http_request, 'content-type', 'application/x-www-form-urlencoded');
UTL_HTTP.set_authentication(http_request, 'temp', 'temppass');
http_response := UTL_HTTP.get_response(http_request);
UTL_HTTP.read_text(http_response, return_text);
dbms_output.put_line (return_text);
END;
/
请有人帮我解决这个问题吗?提前致谢!
【问题讨论】: