我在使用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