[
“import-1″=> [
“operation”=> “import/upload”
],
“import-2″=> [
“operation”=> “import/upload”
],
“merge-1″=> [
“operation”=> “merge”,
“input”=> [
“import-1”,
“import-2”
],
“input_format”=> “jpg”,
“output_format”=> “pdf”,
“options”=> [
“strip_pdf”=> true,
“export_all_object_merge”=> false,
“image_rotation”=> 0
] ],
“export-1″=> [
“operation”=> “export/url”,
“input”=> [
“merge-1”
] ] ] ];
$headers = [
‘Content-Type: application/json’,
‘Accept: application/json’,
‘Authorization: Bearer {sarthakwebsoft}’ // Replace {sarthakwebsoft} with your actual access token
];
$url = “https://api.freeconvert.com/v1/process/jobs”;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($inputBody));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if ($response === false) {
echo ‘cURL error: ‘ . curl_error($ch);
} else {
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode === 200) {
$responseData = json_decode($response, true);
print_r($responseData);
} else {
echo “Request failed with HTTP code: ” . $httpCode;
echo $response;
}
}
curl_close($ch);
?>