我正在使用HTML2PS,並且它在舊服務器上正常工作,已移至新服務器並停止工作。404在找到同一臺服務器時找不到
我已經分離,我通過捲曲訪問臨時文件不是從服務器中,但該文件可以從其他位置獲取(如我的本地機器)
此URL可能不靠近工作中的問題未來,因爲我可能會刪除此鏈接。
http://www.lapchi.com/new/temp_curl.php5
鏈接的代碼是如下
<form method="post">
<input type="text" name="url" value="http://www.lapchi.com/new/uploads/temp/html_pdf/503_S_b7ku0sbn1i8g8ll06ra1pth332.html" size="90" />
<input type="submit" value="go">
</form>
<?php
set_time_limit(8888);
if($_POST){
$url = $_POST['url'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$url); // this file is physically exist on server
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7) Gecko/20040803 Firefox/0.9.3");
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
if ($response === FALSE) {
error_log(sprintf('Cannot open %s, CURL error is: %s',
$url,
curl_error($curl)));
curl_close($curl);
return null;
}
curl_close($curl);
preg_match('/^(.*?)\r\n\r\n(.*)$/s', $response, $matches);
$headers = array_slice(explode("\r\n", $matches[1]),1);
$content = $matches[2];
echo $content;
}
我不知道,爲什麼同一臺服務器上相同的文件無法通過捲曲被發現,但其他人可以CURL這個網址,這頁面可以捲曲的網址
也許是因爲你試圖訪問與捲曲相同的域?合併已經存在於您運行腳本的服務器上的東西是沒有意義的。 – silkfire
爲什麼你會使用curl如果它在同一臺服務器上並且可以通過php訪問? –
HTML2PS是使用CURL創建PDF文件的開源代碼,我面臨的問題是生成的PDF文件顯示'NOT FOUND',所以我創建了這個測試用例。 –