extract/ print img and href tags only

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lauthiamkok
Forum Contributor
Posts: 153
Joined: Wed Apr 01, 2009 2:23 pm
Location: Plymouth, United Kingdom

extract/ print img and href tags only

Post by lauthiamkok »

Hi,
How can I extract/ print <img src="..."/> and <a href="..."> only from a paragraph of text like the text below,

Code: Select all

<img src="pic1.jpg"/><a href="link1.html">Duis autem </a> vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, <img src="pic2.jpg"/>vel illum dolore eu <a href="link1.html">feugiat</a> nulla facilisis ...
Thanks,
Lau
socket1
Forum Commoner
Posts: 82
Joined: Mon Dec 08, 2008 7:40 pm
Location: Shokan, New York

Re: extract/ print img and href tags only

Post by socket1 »

Use RegEx, beyond giving that advice I can't help anymore.
Post Reply