使用SAS包访问https站点

使用SAS包访问https站点,https,sas,Https,Sas,我想通过使用SAS DS2 HTTP包提供用户名和密码等凭据信息来访问https站点。有人能提供代码片段吗?我尝试添加到请求头,但它不起作用。提前谢谢 declare package http h(); h.createGetMethod(url); h.addRequestHeader('WEBUSERNAME', 'username'); h.addRequestHeader('WEBPASSWORD', 'password'

我想通过使用SAS DS2 HTTP包提供用户名和密码等凭据信息来访问https站点。有人能提供代码片段吗?我尝试添加到请求头,但它不起作用。提前谢谢

        declare package http h();
        h.createGetMethod(url);

        h.addRequestHeader('WEBUSERNAME', 'username');
        h.addRequestHeader('WEBPASSWORD', 'password');

WEBUSERNAME
/
WEBPASSWORD
proc http
使用的方法。据我所知,它们不是标准的http头请求。对于凭据,您需要授权。比如:

auth =  put('user:pass',$base64x64.);
h.addRequestHeader('Authorization', 'Basic '||auth);
你不能只使用
文件名url
语句吗?

“谢谢Jetzler”。我正在使用下面这样,它的工作

        h.createGetMethod(url);

        auth =  put('username:Password',$base64x64.);
        h.addRequestHeader('Authorization', 'Basic ' || auth);

        h.executeMethod();

        status = h.getStatusCode();
        put 'Requested resource for country code:' code 'executeMethod() status:' status;

        if status eq 200 then
            do;
                /* 200 = OK */
                /* retrieve the body from the response that came from the server */
                h.getResponseBodyAsString(body, rc);
            end;

        return body;