Re: [PHP] DOM - parse HTML document [solved]

2006-09-13 Thread tedd
At 10:02 PM +0200 9/13/06, Leonidas Safran wrote: Hello Tedd, Interesting -- it doesn't work for me. I keep getting -- Parse error: parse error, unexpected T_OBJECT_OPERATOR -- in your if statement. But, I don't see the problem. Maybe it has something to do with your php version. I h

Re: [PHP] DOM - parse HTML document [solved]

2006-09-13 Thread Leonidas Safran
Hello Tedd, > Interesting -- it doesn't work for me. I keep getting -- > Parse error: parse error, unexpected T_OBJECT_OPERATOR > -- in your if statement. But, I don't see the problem. Maybe it has something to do with your php version. I have php 5.04 installed (Fedora Core 4 rpm package). H

Re: [PHP] DOM - parse HTML document [solved]

2006-09-13 Thread tedd
At 12:07 AM +0200 9/13/06, Leonidas Safran wrote: Hello all, I have found a way... $doc = new DomDocument(); $doc->loadHTMLFile($source["url"]); $elements = $doc->getElementsByTagName("tr"); $i = 0; while( $elements->item($i) ){ if( $elements->item($i)->hasAttributes() && preg_match("/td[0|

Re: [PHP] DOM - parse HTML document [solved]

2006-09-12 Thread Leonidas Safran
Hello all, I have found a way... $doc = new DomDocument(); $doc->loadHTMLFile($source["url"]); $elements = $doc->getElementsByTagName("tr"); $i = 0; while( $elements->item($i) ){ if( $elements->item($i)->hasAttributes() && preg_match("/td[0|1]/",$elements->item($i)->getAttribute("id")) > 0 ){

Re: [PHP] DOM - parse HTML document

2006-09-12 Thread Leonidas Safran
Hello Satyam, > That is correct but it is not complete. Everything that relies > on a unique id would fail, CSS amongst others(which is what this > article covers), but not the only one. > Basically there are two functions to get elements by id or name: > getElementById and getElementsByName.

Re: [PHP] DOM - parse HTML document

2006-09-12 Thread Satyam
- Original Message - From: "Leonidas Safran" <[EMAIL PROTECTED]> By the way, because I found it strange to have more than one field with the same id, I looked on the famous selfhtml tutorial website http://de.selfhtml.org which says that unique id is only mandatory for css, but not fo

Re: [PHP] DOM - parse HTML document

2006-09-11 Thread Leonidas Safran
Hello Satyam, Thanks for your answering... >> I don't really get it to work with that functions from >> http://www.php.net/manual/en/ref.dom.php >> I try to get the content of fields on an external html page, where >> I just know some ids of the rows. >> Example: >> ... >> >> 1234 >> >> >>

Re: [PHP] DOM - parse HTML document

2006-09-11 Thread Satyam
To start with, an ID should never be repeated. A name can be repeated, an ID shouldn't. That is why there is a function to get an array of elements with a certain name but there is none to get a list of elements with the same ID simply because there shouldn't be any. Something helpful in tr