我在网站上有一个curl脚本,它使用CURL向服务器发出请求。另一方面,我使用wkhtmltopdf生成带有HTML的PDF,这在网站上未启用https时工作正常,但是一旦启用https,PDF genetation就会抛出错误。
MY curl script
$url = Yii::app()->params['pdfUrl']; //Equals http://xxx.xx.xxx.xxx/server/?r=pdf/generatePdf
$body = array(
"client_url"=>Yii::app()->params['pdfClientURL'],
"client_id"=>Yii::app()->params['pdfClientID'],
"title"=>urlencode($title),
"content"=>urlencode(($content))
);
foreach($body as $key=>$value) { $body_str .= $key.'='.$value.'&'; }
rtrim($body_str,'&');
curl_setopt ($c, CURLOPT_POST, true);
curl_setopt ($c, CURLOPT_POSTFIELDS, $body_str);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
$pdf = curl_exec ($c);
curl_close ($c);
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=".str_replace(' ', '_', $title).".pdf");
echo $pdf;
Yii::app()->end();
https导致的是什么?
我遇到错误WKHTML2PDF
WKPDF system error: <pre>Loading pages (1/6)
[> ] 0%
[======> ] 10%
[===========> ] 19%
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[============================================================] Page 1 of 1
Done
</pre>
答案 0 :(得分:5)
好的,在@Keeyai指出我正确的方向后发现问题。我设法找到这篇文章http://code.google.com/p/wkhtmltopdf/issues/detail?id=17&q=ssl并在服务器上安装了openssl-devel,其中安装了wkhtml2pdf并解决了问题。由于问题是由使用https链接的图像引起的
yum install openssl-devel做了这个伎俩
答案 1 :(得分:0)
像CURLOPT_SSL_VERIFYPEER = false之类的东西可能会有所帮助。
在与ssl相关的各种选项中查看该页面 - 确保您在那里找到答案...