How to extract img src, title and alt from html using php?
- by Sam
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).