douxian1939 2011-04-06 09:16 采纳率: 100%
浏览 115
已采纳

解析php中的html页面

Today when I was parsing one page with Simple HTML DOM parser I didn't get any result. So I thought, that it must be strange. So I went to see HTML code written there. I found that there's many mistakes.

So here comes the question. What to do in state, when parser works correctly, but HTML is a mess. Maybe some one would suggest some aproach or some other parser which is able to handle, that sort of matters.

Thank you all for help.

  • 写回答

2条回答 默认 最新

  • ds34222 2011-04-06 09:33
    关注

    Run it through tidy before trying to load it into a DOM tree, http://php.net/manual/en/book.tidy.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?