我在使用CURL向服务器发送请求的网站上有一个curl脚本。另一方面,我使用wkhtmltopdf生成与收到的HTML的PDF,这工作正常,当HTT未在网站上启用,但只要我启用HTTPS的PDF遗传抛出错误。https/ssl在通过curl发送HTML时导致问题
MY卷曲脚本
$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>
你能给我们提供错误吗? – 2012-03-20 20:52:38
@Keeyai - 已更新的问题 – Roland 2012-03-20 20:56:24
看起来wkhtml2pdf在ssl下执行有问题,但我不确定它为什么在ssl中做任何事情。我的第一个猜测是,既然你使用https请求,wkhtml2pdf也试图使用ssl来获取图像。我之前没有在ssl下使用过wkhtml2pdf,你可以手动关闭它,或者可以使用http或甚至本地显式加载图像?另一种方法是解决实际问题,并找出为什么wkhtml2pdf与SSL失败 - 你自己编译它? – 2012-03-20 21:04:25