The code would look something like this :- <?php $doc = new DOMDocument(); @$doc->loadHTMLFile('http://www.example.com/mypage.html'); walkDom($doc); function walkDom($node, $level = 0) { $indent = ""; for ($i = 0; $i < $level; $i++) $indent .= ' '; //prettifying the output if($node->nodeType != XML_TEXT_NODE) { echo $indent.'<b>'.$node->nodeName.'</b>'; if( $node->nodeType == XML_ELEMENT_NODE ) { $attributes = $node->attributes; // get all the attributes(eg: id, class .) foreach($attributes as $attribute) { echo ', '.$attribute->name.'='.$attribute->value; // $attribute->name is usually one of these: // src, type, rel, link, name, value, href, onclick, // id, class, style, title // You can add your custom handlers depending on the Attribute. } // if( strlen(trim($node->childNodes->item(0)->nodeValue)) > 0 && count($cNodes) == 1 ) // echo '<br>'.$indent.'(contains='.$node->childNodes->item(0)->nodeValue.')'; // do this to print the contents of a node, which // maybe the link text, contents of div and so on. } echo '<br><br>'; } $cNodes = $node->childNodes; if (count($cNodes) > 0) { $level++ ; // go one level deeper foreach($cNodes as $cNode) walkDom($cNode, $level); //so this is recursion my professor kept talkin' about $level = $level - 1; // come a level up, and had to do it this way or else wordpress would take away one dash. :( } } ?> -----Original Message----- From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Sovichea SOU Sent: 18 March 2010 08:00 To: php-objects@xxxxxxxxxxxxxxx Subject: Re: Website Content Hack Hi Rob, I have a very bad idea. I want to copy data (xyz) from someone's website (every page) that in <div class="content">xyz</div> and insert it automatically into a database. Any more idea? Thanks. On Wed, Mar 17, 2010 at 11:25 PM, Atkinson, Robert <ratkinson@xxxxxxxxxxxxx>wrote: > > > Sovichea, do you have direct access to the files on the server? If not, > then > you can not copy the code. The best you would be able to achieve is copying > the HTML content using file_get_contents(). > > What is it you are trying to do, and perhaps we can tell you the best way > to > do it? > > Rob. > > > -----Original Message----- > From: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> [mailto: > php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>] On > Behalf Of Sovichea SOU > Sent: 17 March 2010 15:14 > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > Subject: Re: Website Content Hack > > rakesh, I am not an php expert. could you give me an example? > > thanks. > > On Tue, Mar 16, 2010 at 10:22 PM, rakesh jangid <jangid1407@xxxxxxxxx<jangid1407%40gmail.com> > >wrote: > > > > > > ***************************************************************************** ****** > Any opinions expressed in email are those of the individual and not > necessarily those of the company. This email and any files transmitted with > it are confidential and solely for the use of the intended recipient or > entity to whom they are addressed. It may contain material protected by > attorney-client privilege. If you are not the intended recipient, or a > person responsible for delivering to the intended recipient, be advised that > you have received this email in error and that any use is strictly > prohibited. > > Random House Group + 44 (0) 20 7840 8400 > http://www.randomhouse.co.uk > http://www.booksattransworld.co.uk > http://www.kidsatrandomhouse.co.uk > Generic email address - enquiries@xxxxxxxxxxxxxxxxx<enquiries%40randomhouse.co.uk> > > Name & Registered Office: > THE RANDOM HOUSE GROUP LIMITED > 20 VAUXHALL BRIDGE ROAD > LONDON > SW1V 2SA > Random House Group Ltd is registered in the United Kingdom with company No. > 00954009, VAT number 102838980 > > ***************************************************************************** ****** > > > [Non-text portions of this message have been removed] ------------------------------------ Are you looking for a PHP job? Join the PHP Professionals directory Now! http://www.phpclasses.org/jobs/ Yahoo! Groups Links