-1
php'de oluşturulan bir web sayfasının html kodunu kaydetmek istiyorum. Ben çalışıyorum temel fikirdir: Ben fopen komutu aklınıza gelebilecek tüm varyasyonlarını denedi ama her zaman üzerinde bir ayrıştırma hatası alıyorumWeb sayfası için tasarlanmış yönlendirme çıkışı
ob_start(); $buffered = true;
fclose (STDOUT);
STDOUT = fopen ("Test/test.htm","wb");
$site_name = 'Cory';
chdir ('..');
include ($site_name.'_V'.$v_defs["sv"].'/Begin.php'); // Draws website
fclose (STDOUT);
.
function get_inner_html($node) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML($child);
}
return $innerHTML;
}
function get_html_table($link,$element,$class){
//$data=date("Y-m-d");
$html = file_get_contents($link); //get the html returned from the following url
$poke_doc = new DOMDocument();
libxml_use_internal_errors(false); //disable libxml errors
libxml_use_internal_errors(true);
if(!empty($html)){ //if any html is actually returned
$poke_doc->loadHTML($html);
libxml_clear_errors(); //remove errors for yucky html
$poke_xpath = new DOMXPath($poke_doc);
$poke_type = $poke_xpath->query("//".$element."[@class='".$class."']");
$table = "<table>";
foreach($poke_type as $type){
$table .= get_inner_html($type);
}
$table .= "</table>";
return $table;
}
adım 2: