How can I fetch all images src into array with file_get_content(), with preg_match or whatever?
How can I fetch all images src into array with file_get_content() , with preg_match
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You shouldn’t use regex to parse HTML. You should use classes like DOMDocument to do so. DOMDocument has the getElementsByTagName method that can be used to retrieve all the img tag from the document you want to parse.
Here’s an example that will echo the list of the images in the document :