Compare commits
No commits in common. "27ca18dd86735448d7199ab27e5ecfbd0b1d4ce3" and "7628f3d2c6a4a86d9cb32eae0377a4edb68768c9" have entirely different histories.
27ca18dd86
...
7628f3d2c6
@ -24,13 +24,11 @@ class UPSAPIs {
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'Authorization: Basic ' . base64_encode("$clientid:$clientsecret")
|
||||
'Content-Type: application/json',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"client_id\": \"$clientid\", \"client_secret\": \"$clientsecret\", \"grant_type\": \"client_credentials\"}");
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$data = json_decode($response, true);
|
||||
$memcache->set("logistics.tracking.ups_bearer_token", $data["access_token"], ($data["expires_in"] * 1) - 120);
|
||||
return $data["access_token"];
|
||||
@ -38,7 +36,7 @@ class UPSAPIs {
|
||||
|
||||
public static function getAPIRequest($endpoint) {
|
||||
$headers = [
|
||||
"Authorization: Bearer " . UPSAPIs::getBearerToken(false),
|
||||
"Authorization: Bearer " . UPSAPIs::getBearerToken(true),
|
||||
"transId: " . uniqid(),
|
||||
"transactionSrc: Netsyms"
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user