custom
loadHTML($html);
$xpath = new DOMXPath($doc);
$fathumbTags = $xpath->query('//td[@class="fathumb"]');
$fatitelTags = $xpath->query('//td[@class="fatitel"]');
// Extract the tags for "faextinfo"
$faextinfoTags = $xpath->query('//td[@class="faextinfo"]');
// Iterate over the extracted tags and display the images and create links
foreach ($fathumbTags as $index => $fathumbTag) {
// Extract the href attribute
$href = $fathumbTag->getElementsByTagName('a')->item(0)->getAttribute('href');
// Extract the image source URL
$imgSrc = $fathumbTag->getElementsByTagName('img')->item(0)->getAttribute('src');
echo "";
//echo " ";
echo "";
// Find the corresponding fatitel tag
$fatitelTag = $fatitelTags->item($index);
// Extract the title text
$title = $fatitelTag->getElementsByTagName('b')->item(0)->textContent;
echo " $title";
// Follow the link and extract the image from the linked page
$linkedHtml = file_get_contents("$url$href");
$linkedDoc = new DOMDocument();
$linkedDoc->loadHTML($linkedHtml);
// Find the image tag in the linked page
$linkedImgTag = $linkedDoc->getElementsByTagName('img')->item(0);
// Extract the image source URL from the linked page
$linkedImgSrc = $linkedImgTag->getAttribute('src');
echo "
";
// Find the corresponding faextinfo tag
$faextinfoTag = $faextinfoTags->item($index);
// Extract the faextinfo text
$faextinfo = $faextinfoTag->textContent;
echo " $faextinfo";
echo "
";
}
?>
Source Code
|