· 7 years ago · Apr 05, 2018, 06:28 PM
1<?php
2
3$client = new http\Client;
4$request = new http\Client\Request;
5
6$body = new http\Message\Body;
7$body->append(new http\QueryString(array(
8 'grant_type' => 'refresh_token',
9 'client_id' => '3MVG9uudbyLbNPZPPXrHFDnQ87gZAkdnvIBfNGhVFsMRF9IMnCz0ZBAscD7DYKfCUwvCvSMmBi1i3o0fLUNSb',
10 'client_secret' => '6641819710113198081',
11 'refresh_token' => '5Aep861QbHyftz0nI_CUu4x53DdiD2l1yOf_kCgktXSUfkBYQ8IPf_fgswmmu.YEg73s9AYqE6llW9.epmzAw2f',
12 'oauth_consumer_key' => '',
13 'oauth_token' => '',
14 'oauth_signature_method' => 'HMAC-SHA1',
15 'oauth_timestamp' => 1520425565,
16 'oauth_nonce' => 'GZGx2Z',
17 'oauth_version' => '1.0',
18 'oauth_signature' => 'pboUsLx6WHs5YJYZ2dAEPAaoBoc='
19)));
20
21$request->setRequestUrl('https://login.salesforce.com/services/oauth2/token');
22$request->setRequestMethod('POST');
23$request->setBody($body);
24
25$request->setHeaders(array(
26 'postman-token' => '2798425b-8bcd-ab6f-1087-1ea34d9c404b',
27 'cache-control' => 'no-cache',
28 'content-type' => 'application/x-www-form-urlencoded'
29));
30
31$client->enqueue($request)->send();
32$response = $client->getResponse();
33
34echo $response->getBody();