![](/img/trans.png)
[英]How can I change the welcome.php in Codeigniter to something like index.php?
[英]TCPDF I can't get the html from another page like index.php?something=something
我正在努力從動態生成的頁面中使用tcpdf創建pdf文件。
我的問題是我有一個日志記錄會話,並且在訪問文件時,如果您未登錄,則僅獲取憑據。
所以我收集html的地方是:
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://www.domain.com/subdir/index.php?something=ref');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name');
$html = curl_exec($curl_handle);
curl_close($curl_handle);
所以運行它后,我得到的是“ HTTP錯誤401:-未經授權”。
希望我的解釋有意義。
任何幫助都感激不盡!
在使用TCPDF處理PDF時,我遇到了相同的問題,其中卷曲CURLOPT_USERAGENT是TCPDF,如下所示。
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'TCPDF');
我只是評論了這一行,並嘗試生成pdf,它起作用了。
我知道這不是正確的方法,但對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.