i need to get href value from class name like that.
some one can give me regex to find this class name and get from there the href ?
<a href='http://www.tovtoda.co.il/BusinessPage.aspx?b=6973' class="boldOrange"></a>
thanks alot
i need to get href value from class name like that.
some one can give me regex to find this class name and get from there the href ?
<a href='http://www.tovtoda.co.il/BusinessPage.aspx?b=6973' class="boldOrange"></a>
thanks alot
You can do this using DomDocument
and XPath
, see here
$str = '<a href="http://www.tovtoda.co.il/BusinessPage.aspx?b=6973" class="boldOrange"></a>';
$doc = new DOMDocument();
$doc->loadHTML($str);
$xpath = new DOMXPath($d);
$links = $xpath->query('//a[@class="boldOrange"]');
foreach ($links as $link) {
$url = $link->getAttribute('href');
print $url . PHP_EOL;
}