Tuesday 19 February 2019

html - How can i get src alone from Image tag using php?











2444


From this image tag I need to take src alone. How can I do this? Is there any predefined functions available?...


Answer




Load it into a DOM tree with loadHtml and do an xpath on it, or directly traverse it if the structure is always the same.



See How to extract img src, title and alt from html using php?


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...