[resolved] Parsing HTML table in filterPostie.php (5 posts)

  1. sniexx
    Posted 1 year ago #


    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?



  2. Wayne Allen
    Plugin Author

    Posted 1 year ago #

    DOMDocument is for XML which HTML isn't necessarily.

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

  3. sniexx
    Posted 1 year ago #

    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.

  4. sniexx
    Posted 1 year ago #

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

  5. Wayne Allen
    Plugin Author

    Posted 1 year ago #

    Thanks for the update

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Postie
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic