Jump to content

native PHP DOM Extension versus simple DOM HTML parser


dilbertone

Recommended Posts

good day dear community,

 

 

this is a big issue. I have to decide: between native PHP DOM Extension or of simple DOM html parser

 

well i want to parse the site here: http://buergerstiftungen.de/cps/rde/xchg/SID-A7DCD0D1-702CE0FA/buergerstiftungen/hs.xsl/db.htm

 

http://buergerstiftungen.de/cps/rde/xchg/SID-A7DCD0D1-702CE0FA/buergerstiftungen/hs.xsl/db.htm

 

I will suggest to use the native PHP "DOM" Extension instead of "simple html parser", since it will be much faster and easier ;)

 

What do you think about this one here...:

 

$doc = new DOMDocument
@$doc->loadHTMLFile('...URL....'); // Using the @ operator to hide parse errors
$contents = $doc->getElementById('content')->nodeValue; // Text contents of #content

 

look  forward to hear from you

 

best regards

db1

Link to comment
Share on other sites

hello dear mikesta

 

many thanks for the quick answer.

 

you seem to have answered your own questions... If the PHP DOM extension is faster and easier to use.. why not use it?

 

thx - great to hear from you! Well many thanks - you help me alot!

 

one question - since i am a php-newbie ;-)  can i apply this code also on another target!?

 

http://buergerstiftungen.de/cps/rde/xchg/SID-F8780E81-ABF20567/buergerstiftungen/hs.xsl/db.htm

 

is this possible to fetch the results ( approx 230 different records) too and parse them!?

 

look forward to hear from you

 

best regards

 

db1

Link to comment
Share on other sites

hi Mikesta

 

I dont see why it wouldn't be possible. Seems very possible to me. I don't know everything about your/their system and setup, but you should be able to scrape that page for the information you want using DOM object.

 

thx for the quick answer. I will try to write the code for

 

1. fetching

2. parsing

3. storing on a local mysql database

 

i come back and report all.. - Then yo can have closer look and give a code review...

 

greetings....

db1 :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.