I'm trying to get CSS background-image URL from HTML Attribute using Simple HTML DOM . This the codes
$String=' <div class="Wrapper"><i style="background-image: url(https://example.com/backgroud-1035.jpg);" class="uiMediaThumbImg"></i></div>';
$html = new simple_html_dom();
$html->load($String);
foreach($html->find('i') as $a0)
$src[$i++]=$a0->style;
foreach( $src as $css )
print($css);
The output is Like this :-
background-image: url(https://example.com/backgroud-1035.jpg);
All I want is strip background Url from the rest of CSS tags . Like this https://example.com/backgroud-1035.jpg
You can use regex to strip out the text between parentheses.