pitbullent Posted September 17, 2009 Share Posted September 17, 2009 Hi! I'm SO CONFUSED. OK all I want to do is use PHP to access a specific website and display only the content of a specific DIV on that website. The class of the div is "content_box". <div class="content_box"> My thoughts lead me to think that I can use $results = file_get_contents('website'); to put all of the HTML into a variable and then use one of the preg functions to extract the div and display it. preg_match('<div class=\"content_box\"> *allow anything including nested divs* </div>', $results, $div); print $div; This is where my ideas fall apart. I have absolutely no idea on how to get started on the regex for a specific div much less allowing for nested divs. Is this the wrong approach altogether? Thank you so much in advance for any ideas or code you can supply! Link to comment https://forums.phpfreaks.com/topic/174628-searching-html-results-of-file_get_contents/ Share on other sites More sharing options...
.josh Posted September 17, 2009 Share Posted September 17, 2009 DOM Link to comment https://forums.phpfreaks.com/topic/174628-searching-html-results-of-file_get_contents/#findComment-920412 Share on other sites More sharing options...
pitbullent Posted September 18, 2009 Author Share Posted September 18, 2009 COOL!! thank you i am definitely going to look into that tommorow Link to comment https://forums.phpfreaks.com/topic/174628-searching-html-results-of-file_get_contents/#findComment-920476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.