Simple PHP Screen Scraping Function -


I am using WordPress with autoblogging (i.e., RSS-based blog postings), and all that is missing One component is automatically fill the content of the post with the content that is linked to RSS's URL link (irrespective of RSS resolution).

By using standard PHP 5, I get the fetch HTML ([URL]) which is & lt; Body & gt; ... & lt; / Body & gt; tag

, I know if there is a pre-order "included" thank you.

assuming that it is always & lt; Body & gt; will not be & lt; Body & gt; or & lt; Body style = "width: 100%" & gt; or and body & gt; and & lt; / Body & gt; , and with the warning that you should not use regex to parse the HTML, even if I am about it, here itself:

  & lt;? Php fetch HTML ($ url) {$ feed = '& lt; Body & gt; There are so many things & lt; / Body & gt; '; $ Content = file_get_contents ($ url); Preg_match ('/ & lt; body & gt; ([\ s \ S] {1,})  / m', $ content, $ match); $ Content = $ match [1]; Return $ content; } // fetch html? & Gt;  

If you select echo fetchHTML ([some url]); , you will find html between body tags.

Please note the basic alerts


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -