2012-02-05 75 views

回答

1

嘗試:

echo htmlentities(file_get_contents('http://stackoverflow.com/questions/ask')); 
+0

非常感謝。此代碼適用於給定的網址。但它不適用於'http://www.maduraonline.com/?find=home'。它只是顯示網頁。任何想法爲什麼這是?我想要這個網頁的HTML代碼,因爲我正在開發一個翻譯。我能做些什麼來獲得它的HTML代碼? 非常感謝 – user1190937 2012-02-06 09:15:42

0

也許嘗試:

$html = htmlspecialchars(file_get_contents('http://stackoverflow.com/questions/ask')); 

並嘗試使用標籤來輸出。

0

只需HTML編碼您的輸出,以便&變爲& amp ;,使用htmlentities函數。

-2

嘗試使用EXEC和wget一起:

<?php 

exec('wget http://stackoverflow.com/questions/ask -O', $array); 

echo implode('<br />', $array); 

?> 
-1
$handle = @fopen("'http://www.webmasterworld.com", "rt"); 
$code = fread($handle,9000); 

這是複製形式另一個線程,但它應該是足夠了。它將獲得$ handle中的代碼,然後$ code將包含該代碼的9000個字節。