PHP Simple HTML DOM Parser fails on a simple example - [driving me nuts]

Hi everyone, good evening! :slight_smile:

I’m trying to select either a class or an id using PHP Simple HTML DOM Parser with absolutely no luck. My example is very simple and seems to comply to the examples given in the manual(PHP Simple HTML DOM Parser) but it just wont work, it’s driving me up the wall.

Here is my example: </TITLE> <META HTTP-EQUIV=“Content-Type” CONTENT=“text/html; charset=iso-8859-1”> <META NAME=“Author” CONTENT=""> <link rel=“stylesheet” type=“text/css” href=“http://www.nibis.de/nli1/nli.css”> <style type=“text/css”> </style> </HEAD> <body bgcolor="](http://schulnetz.nibis.de/db/schulen/schule.php?schulnr=94468&lschb=)

I think the HTML is invalid: i cannot parse it.

Well i need more examples - probly i have overseen something!

If anybody has a working example of Simple-html-dom-parser…i would be happy.
The examples on the developersite are not very helpful.

your dilbertone

BTW - thinking about the most elegant way, i think it is the most pretty way would be to do it with perl - So i think if all fails i should try it with HTML::TableExtract or…

Your HTML is indeed invalid.
I’d give you an example if I could remember where I used the simple parser, usually I use the DOM.
I suppose you did already look at the basic examples PHP: Basic usage - Manual ?

Hello Axeia, [greetings to the netherlands!!;)]

many thanks for the answer!

well since the example is invalid i tried another one!

see this here: Weitere Schulinformationen

I tried all the examples that are written down in the manual: PHP Simple HTML DOM Parser



<?php 

include('simple_html_dom.php');

// Create DOM from URL or file

$html = file_get_html('nrw_test.html');

//Find all anchors, returns a array of element objects
//$ret = $html->find('a');

//Find all <div> which attribute id=foo
//$ret = $html->find('div[id=ldstabTitel]'); 

// Find all links 
foreach ($html->find('a') as $element) 
echo $element->href. '<br>';
echo $element->innertext.'<br>';

?>

All i get is the e-mail-adress - but nothing more…
Axeia, do you have any hint how to extract the data out of the table -

i would be happy to have some starting points…

Snowy greetings to Netherlands!!!
dilbertone