Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old July 31st, 2010, 02:52 AM   #1
New Member
 

Join Date: Jul 2010
Location: India
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Nagadurga is on a distinguished road
scrape continuous webcontent from more number of page

Hi,
I was tried to retrieve the web content from the "http://www.local.ch/en/q/bar.html" link. I use the following code

Code:
<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>
But it can only used to retrieve the first page information. I am in need of extract the content from continuous page. I was tried to extract the second page from the web page. But it gives information which is available in first page. through analyzing the web page source i know that all pages having same sources. how can i rectify it. Please give your valuable suggestion.

Thanks in advance.
Nagadurga is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Total number of links per page ? saidbakr Search Engine Optimization (SEO) 4 July 8th, 2008 07:56 AM
number of php includes on one page? Lchad PHP 7 April 4th, 2007 06:01 PM
Remove page number malambing57 Classic ASP 1 October 14th, 2004 04:47 AM
page error number 2!! benbacardi Classic ASP 13 September 30th, 2004 10:03 AM


Search Engine Optimization by vBSEO 3.2.0 RC8