2016-06-03 4 views
1

SAS DS2 HTTP 패키지를 사용하여 사용자 이름 및 비밀번호와 같은 자격 증명 정보를 제공하여 https 사이트에 액세스하려고합니다. 아무도 코드 스 니펫을 제공해 줄 수 있습니까? 요청 헤더에 추가를 시도했지만 작동하지 않습니다. 미리 감사드립니다.SAS 패키지를 사용하여 https 사이트에 액세스

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

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

답변

1

WEBUSERNAME/WEBPASSWORDproc http 의해 사용되는 방법이다. 내가 아는 한 그들은 표준 http 헤더 요청이 아닙니다. 자격 증명을 얻으려면 승인이 필요합니다. 다음과 같이 입력하십시오 :

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

filename url 문을 사용할 수 있습니까?

0

"Thanks 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; 
관련 문제