Jump to content
Sign in to follow this  

Simple PHP Cloaked Link Checker

Recommended Posts

Note: This is intended to be used in the Command Line Interface and you can't hardcode the URL without bug fixing it.


//Curl as Googlebot, intended for CLI

$requestUrl = ""; //hardcode the URL if desired

if (($argc<2) && ($requestUrl == "")){
	die("Usage: program URL\n");
	$requestUrl = $argv[1];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');

$output = curl_exec($ch);


//dump the links to the console
$dom = new DOMDocument;


$links = $dom->getElementsByTagName('a');

foreach ($links as $link){
	echo $link->nodeValue . " : ";
	echo $link->getAttribute('href') . "\n";


Share this post

Link to post
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.