Posted by:
RiggsFolly
(---.dynamic.dsl.as9105.com)
You use DomDocument when processing some web page that you decide to scrape and not to build your own pages.
EG
$xml = new DOMDocument();
// Load the url's contents into the DOM
$xml->loadHTMLFile('http://www.google.com');
// Empty array to hold all links to return
$links = array();
//Loop through each <a> tag in the dom and add it to the link array
foreach ($xml->getElementsByTagName('a') as $link) {
$url = $link->getAttribute('href');
if (!empty($url)) {
$links[] = $link->getAttribute('href');
}
}
print_r($links);
---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>Read The Manuals Apache --
MySQL --
PHP --
phpMyAdminGet your Apache/MySQL/mariaDB/PHP ADDONs here from the
WAMPServer alternate Repo-X-X-X-
Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-