其實主要方法就是使用PHP獲得服務器頁面,同時利用SCRIPT的innerText屬性,獲得所有文字,如果做處理可以將這些值傳入進行處理.
我這裡只是暫時將所有文字獲得顯示,其實就是innerText而已,
代碼在下面,你看看是否是否符合你需要
=============================
主體.php
-------------
<?php
//讀取頁面的時候經常會超出系統允許的執行時間
set_time_limit(0);
//傳入參數
$url = isset($_GET[u])&&strlen($_GET[u])>4?$_GET[u]:"http://group.php5group.com";
//常值
$afile = "script.html"; //注意,這裡是顯示或者獲得HTML文件的一些操作方法
$objfile = "s_".time().".php";
//獲得內容(請注意PHP版本,如果過底低於4.3.0版本請使用fopen等組合使用)
$sourcecontent = file_get_contents($url);
$acontent = file_get_contents($afile);
$objcontent = $sourcecontent."\r\n\r\n\r\n\r\n".$acontent;
//寫入內容
$fp = @fopen($objfile,"w");
@fputs($fp,$objcontent);
@fclose($fp);
//打印出訪問地址
echo "<a href=\"$objfile\" target=_blank>$objfile</a>";
?>
script.html
----------------
<script language="javascript">
document.write(document.body.innerText);
</script>
主要是script.html文件內的 document.body.innerText屬性,你可以考慮一下.
|