HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/fb-order-invoice/index.php
<?php
$invoice_pdf = isset($_GET['invoice_pdf']) ? $_GET['invoice_pdf'] : '';
if($invoice_pdf){

    $pos = strrpos($invoice_pdf, '/');
    $pdfname_orderid = $pos === false ? $invoice_pdf : substr($invoice_pdf, $pos + 1);




$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.pdfshift.io/v3/convert/pdf",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode(array("source" => $invoice_pdf, "landscape" => false, "use_print" => true)),
    CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
    CURLOPT_USERPWD => 'api:2971bbb159f44c919a10cca268e28fc6'
));

$response2 = curl_exec($curl);
$pdfname = $pdfname_orderid.'.pdf';

$ok = file_put_contents('invoice/'.$pdfname, $response2);
$response = array();
if($ok)
{
    $response['errorcode'] = '200';
    $response['errormessage'] = 'success';
    $response['response'] = $response2;
    $response['pdf_url'] = 'http://172.105.42.62/fb-order-invoice/invoice/'.$pdfname;
}
else
{

    $response['errorcode'] = '201';
    $response['errormessage'] = 'failed';
    $response['pdf_url'] = '';
    $response['response'] = $response2;

}
echo json_encode($response);
}
// We even made a GIST for you at:
// https://gist.github.com/cnicodeme/f2c73d89ac49313d023d738b5cdb7046
?>