dale Nale
dale Nale

Reputation: 21

File_get_contents to get the source code of remote page then display only specific div

exactly as its descriped in the title currently my code is:

<?php
    $url = "http://www.vipboxsports.me/football/23863/1/chelsea-tv-live-stream-online.html";
    $html = str_get_html($url);
    $elem = $html->find('div[id=streambox]', 0);
    echo $elem;
?>

but at this point its not working what is the problem with code above

Upvotes: 0

Views: 1540

Answers (2)

DevZer0
DevZer0

Reputation: 13525

you need to use file_get_html. str_get_html is when you have a string of html already.

$url = "http://www.vipboxsports.me/football/23863/1/chelsea-tv-live-stream-online.html";
$html = file_get_html($url);
$elem = $html->find('div[id=streambox]', 0);
echo $elem;

Upvotes: 1

gayan
gayan

Reputation: 212

<?php
    $url = "remotesite.com/pages/page1.html";
    $html = str_get_html($url);
    $elem = $html->find('div[id=mydiv]', 0);
    echo $elem;
?>

Upvotes: 0

Related Questions