Advertisement
MChaos

UPS

Dec 4th, 2023
881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. $curl = curl_init();
  2.  
  3.             $payload = "grant_type=authorization_code&code=".$_GET['code']."&redirect_uri=https://mdeliverywine.co.uk/ups/callback&client_id=4AGdWW41GyA3ehKAM3OzyK5vZiLgnXBxrjSfdkrYqY2PxXbV";
  4.  
  5.             curl_setopt_array($curl, [
  6.                 CURLOPT_HTTPHEADER => [
  7.                     "Content-Type: application/x-www-form-urlencoded",
  8.                     "Authorization: Basic bWRlbGl2ZXJ5NDgyOnp5bmhpay1jb3d3RWQtM3FpeHJ1"
  9.                 ],
  10.                 CURLOPT_POSTFIELDS => $payload,
  11.                 CURLOPT_URL => "https://wwwcie.ups.com/security/v1/oauth/token",
  12.                 CURLOPT_RETURNTRANSFER => true,
  13.                 CURLOPT_CUSTOMREQUEST => "POST",
  14.             ]);
  15.  
  16.             $response = curl_exec($curl);
  17.             $error = curl_error($curl);
  18.  
  19.             curl_close($curl);
  20.  
  21.             if ($error) {
  22.                 echo "cURL Error #:" . $error;
  23.             } else {
  24.                 echo $response;
  25.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement