I have these code to view pdf file using PHP language.
But my PDF file is in another remote server this server have HTTPS.
Below code is to call the pdf file.
It works for HTTP. But for HTTPS, failed to load the document.
Php file
$cookie = 'cookies.txt';
$timeout = 30;
$url = "https://www.test.com/viewpdf/view.pdf";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_PROXY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
header('Content-type: application/pdf');
$result = curl_exec($ch);
curl_close($ch);
echo $result;
What am I missing here ?
Appreciate if someone can help me.
Thanks.