Skip to main content
Participant
October 10, 2025
Question

compression API extenal call

  • October 10, 2025
  • 0 replies
  • 33 views

Is it possible to give the upload temp file url as input to the compression API. Getting a 500 error for that. Below is my code:-

 

$ch = curl_init('https://pdf-services-ue1.adobe.io/operation/compresspdf');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: ' . $client_id,
'Authorization: Bearer ' . $accessToken,
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => new CURLFile($upload['tmp_name'], 'application/pdf', $upload['name'])//temp file
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true); // capture headers
curl_setopt($ch, CURLOPT_VERBOSE, true); // (optional) for debugging

$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);

curl_close($ch);