Pulling content from external website

Hi guys,

wondering if someone can help me out here

basically i want to pull some content from an external website, i just want to know how to target a specific div class

the content i want to pull is just in one div on the external website, im not sure how i can pull just the content i need

and apply my own styling to it

can someone people help me out :blush:

Check out the streams page on the php manual PHP: Streams - Manual.

To get the content of the page

$opts = array( 'http' => array( 'method' => 'GET' ) );
$context = stream_context_create( $opts );

$stream = fopen( 'http://www.yourexternalsite.com', 'r', false, $context );

To filter out the content you don’t need you can make use of stream filters. More details here PHP: stream_filter_register - Manual (see the examples).

Hope this helps.

Or… you could just pull the code using file_get_contents and then parse it as a DOMDocument … Unless the page is -extremely- long, retrieving the raw HTML shouldnt take more than a heartbeat.