I want to get img src from RSS feed, but I only need image inside <div class="img" not any other class="favicon" img src. But when I get image it's not the original image but it's returning the favicon. How can I fix it? Here is the feed link "http://rss.disp.cc/PttHot.xml" . And here is my code:
<?php
$ptt = simplexml_load_file('http://rss.disp.cc/PttHot.xml');
foreach ($ptt->entry as $entry ) {
$content = $entry -> content;
preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $content, $images);
if(!empty($images)){$img = $images[1];}else{$img="";}?>
I am trying to get image from content and here is multiple img src inside content but I only need original image inside <div class="image"> and img style="max-width:100%;" not other extra favicon. Please help - I tried multiple solutions but I can't fix.