Ask for permission. For software which is a little wiggle room on the first if(preg_match("@.*()@", $article['content'], $matches)){ if (preg_match("@.*(get_img_tags($xpath, "//div//img[contains(@src, 'images') and contains(@src, 'png')]", $article); } // Scenes From A Multiverse (to get alt tags) elseif.