I am currently using simple_html_dom to clear the website here , to see the website I am scraping, everything is returning well, except that it continues to post the same content for every single message that it scratches. View here to see a demo.
$page = (isset($_GET['p'])&&$_GET['p']!=0) ? (int) $_GET['p'] : ''; $html = file_get_html('http://screenrant.com/movie-news/'.$page); foreach($html->find('#site-top > div.site-wrapper > div.top-content > article > section > ul > li > div.info > h2 > a') as $element) { print '<br><br>'; echo $url = ''.$element->href; $html2 = file_get_html($url); $image = $html2->find('meta[property=og:image]',0); $news['image'] = $image->content;
I have no idea where I am wrong, but I assume that this is one of two things, and I did not believe both of these things without luck.
1. I'm doing something wrong with the way my foreach .
2. The website changes selectors for each new article.
In both cases, Iām probably mistaken .. but I worked with them both for 2 hours, and at the time of refusing them. Any help is greatly appreciated.
php
Placeholder
source share