Folks,
I am a beginner and still on Procedural Style Php.
Do you mind converting this code to Procedural Style so I can learn from it to extract links off from a cURL fetched webpage ?
[code]
<?php
//Code from: https://potentpages.com/web-crawler-development/tutorials/php/techniques
//Assuming your contents are in a variable called $contents
//New DOM Document
$document = new DOMDocument;
//Load HTML in $contents variable
$document->loadHTML($contents);
//Get all links
if($links = $document->getElementsByTagName(‘a’)) {
//Loop through all links
foreach($links as $node) {
//Get link location (href)
$link_href = $node->getAttribute(‘href’);
//Get link text
$link_text = $node->nodeValue;
}
}
?>
Cheers!