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

0 votes

I want to make a page listing all of the photographs on my website along with their titles and alternative representations.

I already created a little program to locate and load every HTML file, but I am having trouble figuring out how to extract the src, title, and alt attributes from this HTML:

<img src="/image/johnny.jpg" title="my pet johnny" alt="pretty and adorable" />

The sequence of the tags may vary, and I need all of them, so I suppose this should be done with some regex, but I'm not really sure how to parse this elegantly (I could do it the hard char by char way, but that's awful).

Jul 21 in HTML by Ashwini
• 1,160 points
14 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
0 answers

How to make a simple modal pop up form using jquery and html?

I've read the jQuery tutorials, but I'm ...READ MORE

Jul 24 in HTML by Ashwini
• 1,160 points
18 views
0 votes
0 answers

How to make a back-to-top button using CSS and HTML only?

I'm attempting to create a back-to-top button ...READ MORE

Aug 1 in HTML by Ashwini
• 1,160 points
10 views
+1 vote
1 answer

How can i create simple register form using html and css?

Html5 contains lots of elements using which ...READ MORE

answered Jan 31, 2020 in HTML by Niroj
• 82,740 points
3,074 views
0 votes
0 answers

How to do calculation in PHP using a csv file for retrieving data?

Morning, I have a csv file and i ...READ MORE

Feb 11, 2020 in HTML by anonymous
• 140 points
891 views
0 votes
0 answers

How to hide image broken Icon using only CSS/HTML?

I need to hide this error image/ ...READ MORE

May 27 in HTML by Tejashwini
• 1,660 points
91 views
0 votes
0 answers

How to convert IPython notebooks to PDF and HTML?

How do I convert ipython-notebooks to print, ...READ MORE

Jun 3 in HTML by Tejashwini
• 1,660 points
25 views
0 votes
0 answers

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

I am working on a page where ...READ MORE

Jun 3 in PHP by Kichu
• 19,040 points
58 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
4,754 views
0 votes
1 answer

Vertically centering text in a div

Try this code: .smallUnitBox { ...READ MORE

answered Sep 3, 2018 in Blockchain by digger
• 26,720 points
271 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP