-2
我想从Play商店whatsapp中获取新文本。我正在尝试下面的代码,它运行良好。PHP file_get_contents按类名从多个div中获取所有内容
<?php
$url = 'https://play.google.com/store/apps/details?id=com.whatsapp&hl=en';
$content = file_get_contents($url);
$first_step = explode('<div class="recent-change">' , $content);
$second_step = explode("</div>" , $first_step[1]);
echo $second_step[0];
?>
问题是,此代码仅显示来自first recent-change div类的文本。它有多个div,最近更改类名称。如何从中获取所有内容?
[DOM日DOM DOM DOM(http://php.net/manual/en/class.domdocument.php) – CD001
请仔细阅读[什么话题能我问](http://stackoverflow.com/help/on-topic) 和[如何问一个好问题](http://stackoverflow.com/help/how-to-ask) 和[the完美的问题](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) 以及如何创建[最小,完整和可验证示例](http:// stackoverflow。 com/help/mcve) 还有[参观](http://stackoverflow.com/tour) – RiggsFolly
你有使用domdocument导航与xpath! – MikeSouto