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, 2022 in HTML by Ashwini
• 5,430 points
304 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, 2022 in HTML by Ashwini
• 5,430 points
342 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, 2022 in HTML by Ashwini
• 5,430 points
239 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,880 points
4,173 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
1,226 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, 2022 in HTML by Tejashwini
• 3,820 points
438 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, 2022 in HTML by Tejashwini
• 3,820 points
240 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, 2022 in PHP by Kichu
• 19,050 points
790 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
9,077 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,740 points
550 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP