regex - How can i take src value from jquery zoom using regular expression in php -
i tried
$content =file_get_contents("http://www.starplugins.com/cloudzoom"); preg_match('/<img[\s\s][^>]*src="([^"]*)"[^>]*id="zoom1"[^>]*>/',$content,$arr); print_r($arr);
it returns empty array when take html part , tested rubular gives correct output.please figure out
try this:
/\<img.*?id\=["\']zoom1["\'].*?src\=["\'](.+?)["\'][\s]{0,}.*?\/{0,1}\>/ims
if returns false, try this:
/\<img.*?src\=["\'](.+?)["\'][\s]{0,}.*?id\=["\']zoom1["\'].*?\/{0,1}\>/ims
.
basically, regex highly dependent upon order of id , src.
however, since dealing html here, better use dom/xpath instead.