Hi all .i am using the following code to get the image thumb and url from a remote html .The code is working but the problem is that it outputs some unwanted images !! could any one help me so i can output only those images that are like the give html and omit the rest.Thanks
PHP Code:$photos = "http://www.somesite.com/images.html";
curl_setopt($ch, CURLOPT_URL, $photos);
curl_setopt($ch, CURLOPT_POST, 0);
$pagecontents = curl_exec($ch);
$pattern = "/src=[\"‘]?([^\"’]?.*(png|jpg|gif))[\"’]?/i";
preg_match_all($pattern, $pagecontents, $matches);
$count = count($matches[1]);
echo $count;
html of images to consider:
HTML Code:<div class="photo_index_item"> <div id="dvImgListHypImage"> <a id="ctl00_cpMain_UserViewPictureControl_ImageListings1_dlImageList_ctl14_hypImage" title="image name" class="photo_image" href="http://www.somsite.com/imagelink2"><img title="image name" src="http://www.somesite.com/m_d1288db7a7c2ab5c34b521ac62eb3e43.jpg" style="border-width:0px;" /></a> </div>




Reply With Quote