I was tried to retrieve the content from continuous web pages. I used the following code to extract the content from web page
Code: Select all
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<table>
<tr>
<td>
<center><h3> Bar Name </h3></center>
<?php
$html = file_get_contents ('http://tel.local.ch/en/q/bar.html?typeref=res');
$dom = new DomDocument();
@$dom->loadHTML ($html);
$xpath = new DOMXPath ($dom);
$key1 = $xpath->query ('//*[@class="fn"]');
foreach($key1 as $keys){
echo $keys->nodeValue ,"<br/> \n";
}
?>
</td>
<td>
<center><h3> Address </h3></center>
<?php
$html = file_get_contents ('http://tel.local.ch/en/q/bar.html?typeref=res');
$dom = new DomDocument();
@$dom->loadHTML ($html);
$xpath = new DOMXPath ($dom);
$key2 = $xpath->query ('//*[@class="adr"]');
foreach($key2 as $keys){
echo $keys->nodeValue ,"<br/> \n";
}
?>
</td>
<td>
<center><h3> Conduct </h3></center>
<?php
$html = file_get_contents ('http://tel.local.ch/en/q/bar.html?typeref=res');
$dom = new DomDocument();
@$dom->loadHTML ($html);
$xpath = new DOMXPath ($dom);
$key3 = $xpath->query ('//*[@class="phonenr"]');
foreach($key3 as $keys){
echo $keys->nodeValue ,"<br/> \n";
}
?>
</td>
</tr>
</table>
</html>
Thanks in advance.