Support » Plugins and Hacks » [Resolved] Parsing HTML table in filterPostie.php

[Resolved] Parsing HTML table in filterPostie.php

  • Hi,

    in filterPostie.php I have a function for parsing content, because all emails are a HTML table, which I have to parse before posting (some fields in table define category, title, author, …). I tried with DOMDocument and simple dom but I just can’t get it to work. Everytime I try to get text from a cell and write it in post field (post_category, post_content, post_title, …), it writes empty string instead of writing text in post field. Can anybody help me?



Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Wayne Allen


    DOMDocument is for XML which HTML isn’t necessarily.

    Postie loads SimpleHtmlDom (http://simplehtmldom.sourceforge.net/manual.htm) so I would use that instead.

    I’m trying with SimpleHtmlDom now and still can’t get it to work. It looks like, when I load html (str_get_html), I can split it by ‘tr’ and ‘td’, but cannot search for text in a cell (I have to do this, so I can set correct post fields). I tried with ‘plaintext’, ‘innertext’, ‘find’ and all return empty string. Basically it’s like this:
    I have a html table with few rows and each row has two tds. In first td is keyword and in second is value. What I have to do is search through first tds and when certain keyword is found (I need value from a cell to compare strings), the value is written in the corresponding post field.
    Do you have any idea how this can be done? I tried everything I could think of and without success.

    Update: I just managed to get it to work like I want 🙂 The problem was in wrong comparison of strings.

    Plugin Author Wayne Allen


    Thanks for the update

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Parsing HTML table in filterPostie.php’ is closed to new replies.