Over a million developers have joined DZone.

Export All Links From Any Page - PHP Code - Outbound/Inbound Links Checker

·
This code will show all internal and external links individually and also in count. This is being used in link checker as outbound links checking option.



URL here:
$ExternalDomainsInArray, 'InternalLinks'=>$InternalDomainsInArray ); return $LinksResultsInArray; } if(isset($_POST['submit']) && $_POST['submit'] == 'submit') { $url = $_POST['url']; $linksInArray = get_a_href($url); $CountOfExternalLink = count($linksInArray['ExternalLinks']); $CountOfInternalLink = count($linksInArray['InternalLinks']); echo "

Linking structure

"; if(!empty($linksInArray['ExternalLinks'])){ echo "
External Links found: (".$CountOfExternalLink.")
    "; foreach($linksInArray['ExternalLinks'] as $key => $val){ $val = preg_replace("/" . htmlentities($val) . ""; } echo "
"; }else{ echo "
No External Links found

"; } if(!empty($linksInArray['InternalLinks'])){ echo "
Internal Links found: (".$CountOfInternalLink.")
    "; foreach($linksInArray['InternalLinks'] as $key => $val){ $val = preg_replace("/" . htmlentities($val) . ""; } echo "
"; }else{ echo "
No Internal Links found

"; } } ?>
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}