Salesforce.com에 인증 된 GET 요청을 보내려고하면 오류가 발생합니다 (INVALID_SESSION_ID).Wordpress 플러그인에서 Salesforce를 인증 할 수 없습니다.
if (!class_exists('WP_Http')) {
include_once(ABSPATH . WPINC . '/class-http.php');
}
// This is obviously the real username
$username = '[email protected]';
// And this is obviously the real password concatonated with the security token
$password = 'xxxxxxxxxxxxxx';
function getMembershipTables() {
$api_url = 'https://na15.salesforce.com/services/apexrest/directory';
$headers = array('Authorization' => 'Basic ' . base64_encode("$username:$password"));
$args = array('headers' => $headers);
$request = new WP_Http;
$result = $request->request($api_url, $args);
$body = $result['body'];
echo "$body";
}
add_shortcode('MembershipTables', 'getMembershipTables');
은 내가 성공적으로 칠 수 있음을 유의하십시오 : 여기
플러그인 기본적으로 바로 [MembershipTables] 단축 코드를 가지고 어떤 페이지에 REST 응답의 몸을 출력 전체에서이다 끝점을 Curl로 끝내지 만 이전 SOAP API를 사용하여 Salesforce에서 얻은 세션 토큰을 사용하여 동등하게 유지합니다 (예 : 클라이언트 ID/비밀번호 없음).WP_Http에 문제가 있습니까? 또는 basic auth를 사용하여 Salesforce.com 요청을 인증 할 수 있습니까?
감사합니다.