html code
<img src="http://website/image/ngshjk.jpeg" onload="img_onload(this);" onerror="img_onerror(this);" data-pid="dynamicvalue" data-imagesize="ppew" data-error-url="http://img.comb/6/z2default.jpg" class="small_image imagezoom " alt="image" title="" id="visible-image-small" rel="dynamicvalue" data-zoom-src="http://img.comb/6/z21347.jpeg" style="display: inline;"> php code
preg_match_all('/<img(.*) onload="(.*)" \/s',$con,$val); already page have many img tag. tried src of particular image using attributes inside img tag. cannot correct in preg_match_all. please correct me in getting source in above img tag.
you might better off using lazy .*? instead of greedy .*.
preg_match_all('/<img(.*?)\sonload="([^"]*)"/s',$con,$val); and change second .* [^"]* instead.
.*? matches least number of characters until next match (in case onload...) , [^"]* matches non quotes characters in between quotes.
Comments
Post a Comment