简体   繁体   中英

How can I get Website Data by Reading Div-Contents of them

I know about API's but i'm looking for a more universal solution.

With this Code I get the DIV-Construction of a foreign Website.

 $url = 'http://www.Abc.de';
        $response = file_get_contents($url);
        echo $response; 

but the Javascript doesent fill content. It also doesent works with include. Is there a Possibility to read Data about the Browser? Like an Eye do?

for include you must enable allow_url_include = On in php.ini and if you want to find div in page use HTML DOM

$dom = new DOMDocument;
$dom->loadHTML('url');
foreach ($dom->getElementsByTagName('div') as $div) {
    $divs[]=$div->nodeValue;
}
print_r($divs);

good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM