How to extract img src, title and alt from html using php?
Posted
by Sam
on Stack Overflow
See other posts from Stack Overflow
or by Sam
Published on 2008-09-26T08:33:05Z
Indexed on
2010/03/19
15:11 UTC
Read the original article
Hit count: 229
I would like to create a page where all images which reside on my website are listed with title and alternative representation.
I already wrote me a little program to find and load all html files, but now I am stuck at how to extract src, title and alt from the html
< img src="/image/fluffybunny.jpg" title="Harvey the bunny" alt="a cute little fluffy bunny"/>
I guess this should be done with some regex, but since the order of the tags may vary, and I need all of them, I don't really know how to parse this in an elegant way (I could do it the hard char by char way, but thats painful).
© Stack Overflow or respective owner