<?php
$html = <<<HTML
<li style="opacity: 1;">
<a class="profile-link" href="CompanyProfile.aspx?PID=4813&country=211&practicearea=0&pagenum=" title="1-844-Iran-Law">Amin Alemohammad</a>
<!--<a class="profile-link" href="javascript:void(0)" title="1-844-Iran-Law">Amin Alemohammad</a>-->
<img src="/Images/Uploaded/Photos/4813_1844IranLaw.png" style="max-width:140px; max-height:140px">
<div class="results-profile">
<h2>Amin Alemohammad</h2>
<p><strong>Firm:</strong> 1-844-Iran-Law <br> <strong>Country:</strong> USA</p>
<p class="blue"><strong>Practice Area:</strong> Iranian Desk</p>
<ul>
<li class="tel-icon" style="opacity: 1;">Tel: +1-202-465-8692</li>
<li class="fax-icon" style="opacity: 1;">Fax: +1-202-776-0136</li>
<li class="email-icon">Email: <a style="position:relative; z-index:9999;" href="mailto:amin@1844iranlaw.com">amin@1844iranlaw.com</a></li>
</ul>
</div><!-- results profile -->
<img class="practice-logo" src="/Images/Uploaded/Logos/4813_1844IranLaw.png" style="max-width:185px; max-height:70px;">
<a class="results-btn contact-btn" href="CompanyProfile.aspx?PID=4813&country=211&practicearea=0&pagenum=" title="View Full Profile">VIEW FULL PROFILE</a>
<!--<a class="results-btn contact-btn" href="CompanyProfile.aspx?PID=4813&country=211&practicearea=0&pagenum=" title="1-844-Iran-Law">CONTACT</a>-->
<a class="results-btn website-btn" href="http://www.1844iranlaw.com" title="www.1844iranlaw.com">VIEW WEBSITE</a>
</li>
HTML;
$dom=new DOMDocument;
//libxml_use_internal_errors(true); // for <li> warning suppress
$dom->loadHTML($html);
//libxml_clear_errors(); // for <li> warning suppress
$xpath = new DOMXPath($dom);
foreach ($xpath->evaluate("//a[@class='profile-link']") as $node) {
parse_str(parse_url($node->getAttribute('href'), PHP_URL_QUERY), $output);
$output['title'] = $node->getAttribute('title');
$output['text'] = $node->nodeValue;
}
var_export($output);
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array (
'PID' => '4813',
'country' => '211',
'practicearea' => '0',
'pagenum' => '',
'title' => '1-844-Iran-Law',
'text' => 'Amin Alemohammad',
)
preferences:
42.97 ms | 408 KiB | 5 Q