PHP Links Extractor

To easily extract links from URL...

PHP Links Extractor

php-links-extractor.php

 

<?php

$link = "https://www.ludo.one"; // edit here

$content = file_get_contents($link);
$dom = new DOMDocument('1.0');
@$dom->loadHTML($content);
$anchors = $dom->getElementsByTagName('a');
$domaine = explode("/",$link);

$liens = array();
$rliens = "";
$hliens = "";
foreach ($anchors as $element) {
$href = $element->getAttribute('href');
if (0 === strpos($href, 'http')) {
$linkb = explode("/",$href);
if($linkb[2] !== $domaine[2]){
$liens[]= $href;
}
}
}

$rlink = array_unique($liens);

for($i=0;$i<count($rlink);$i++){
if($lineContent !== ""){
if($i===0){
$rliens .= $rlink[$i];
$hliens .= $rlink[$i];
}
else{
$rliens .= "\n".$rlink[$i];
$hliens .= "<br>".$rlink[$i];
}
}
}
file_put_contents("urls-".$domaine[2].".txt", $rliens);
$hliens = preg_replace("/<br><br><br><br>/","<br>",$hliens);
$hliens = preg_replace("/<br><br><br>/","<br>",$hliens);
$hliens = preg_replace("/<br><br>/","<br>",$hliens);
$hliens = preg_replace("/<br><br>/","<br>",$hliens);
echo preg_replace("/<br><br>/","<br>",$hliens);

?>

 

 

Ludo.One

Quality tools for Webmasters !

A collection of free or paid PHP scripts and Prestashop modules. Download free and paid website scripts and tools. Each of the PHP scripts here includes complete PHP source codes

Contact Details

Phone: +33781217982
Email:
Website: www.Ludo.One