$variable = '<img src="http://www.gravatar.com/avatar/66ce1f26a725b2e063d128457c20eda1?s=32&d=identicon&r=PG" height="32" width="32" alt=""/>';
How to get src of this image?
Like:
$src = 'http://www.gravatar.com/avatar/66ce1f26a725b2e063d128457c20eda1?s=32&d=identicon&r=PG';
Thanks.
use regex
And src will be in $match, see print_r( $match ). But this is only for this situation, if you want universal solution (like ' against " etc.) use html/DOM parser.
You can use an html parser for this. See this one: http://simplehtmldom.sourceforge.net/ (I hope this works for nodes, not just for entire pages).
Use HTML DOM. Download and include simple_html_dom.php file in your script.
Then get image URLs like this: