I would like to scrape comments from Reddit using Simple HTML DOM, this is the address: https://old.reddit.com/r/UnresolvedMysteries/comments/.
I would like to scrape the texts in the paragraph tag only and store them in an array, but I can unfortunately not get it to work.
<div class="usertext-body may-blank-within md-container " >
<div class="md">
<p>What book? I’d like to check it out</p>
</div>
</div>
I suspect the problem is this section: "usertext-body may-blank-within md-container " >. This is my code, what is the correct code?
foreach($html->find('.usertext-body may-blank-within md-container ') AS $results) {
foreach($results->find('p') AS $comment){
$comments[] = $comment;
}}