I have these 2 queries:
1) Get all the URL of the images:\[code\]$imgs = $xpath->query('//div[@class="pin"]/div[@class="PinHolder"]/a/img');\[/code\]
2) Get how many people facebook-liked every image:\[code\]foreach($xpath->query('//span[@class="LikesCount"]') as $span) { $int = (int) $span->nodeValue; if ($int > 5) { echo $i++ . "--> " . $int . "<br />"; }}\[/code\]
I'd like to merge them to get just the images which has been facebook-liked more than 5 timesThat said, pictures that hasn't been liked don't have the LikesCount class at all.Follow an example of the Markup:\[code\]<div class="pin">[...]<a href="http://stackoverflow.com/pin/56787645270909880/" class="PinImage ImgLink"> <img src="http://media-cache-ec3.pinterest.com/upload/56787645270909880_d7AaHYHA_b.jpg" alt="Krizia" data-componenttype="MODAL_PIN" class="PinImageImg" style="height: 288px;"></a><p class="stats colorless"> <span class="LikesCount"> 22 likes </span> <span class="RepinsCount"> 6 repins </span></p>[...]</div>\[/code\]
1) Get all the URL of the images:\[code\]$imgs = $xpath->query('//div[@class="pin"]/div[@class="PinHolder"]/a/img');\[/code\]
2) Get how many people facebook-liked every image:\[code\]foreach($xpath->query('//span[@class="LikesCount"]') as $span) { $int = (int) $span->nodeValue; if ($int > 5) { echo $i++ . "--> " . $int . "<br />"; }}\[/code\]
I'd like to merge them to get just the images which has been facebook-liked more than 5 timesThat said, pictures that hasn't been liked don't have the LikesCount class at all.Follow an example of the Markup:\[code\]<div class="pin">[...]<a href="http://stackoverflow.com/pin/56787645270909880/" class="PinImage ImgLink"> <img src="http://media-cache-ec3.pinterest.com/upload/56787645270909880_d7AaHYHA_b.jpg" alt="Krizia" data-componenttype="MODAL_PIN" class="PinImageImg" style="height: 288px;"></a><p class="stats colorless"> <span class="LikesCount"> 22 likes </span> <span class="RepinsCount"> 6 repins </span></p>[...]</div>\[/code\]