Created
August 10, 2016 08:50
-
-
Save JahsonKim/73ff601cbf23464a6395a042c19741e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('simple_html_dom.php'); | |
$html = new simple_html_dom(); | |
if(isset($_POST['crawl'])){ | |
$crawl = $_POST['target']; | |
$find = "http://"; | |
//Change "http://" to https// if you are crawling a an https site otherwise keep it http | |
if(strpos($crawl,$find)!==false){ | |
$html->load_file($crawl); | |
foreach($html->find('a') as $link) | |
{ | |
if(strpos($link,"$crawl")!==false){ | |
echo "<p class='links'>".$link->href."</p>"; | |
} | |
else if(strpos($link,"http://")!==false || strpos($link,"https://")!==false){ | |
echo "<p class='links'>".$link->href."</p>"; | |
} | |
else{ | |
echo "<p class='links'>"."$crawl/".$link->href."</p>"; | |
} | |
} | |
} | |
else{ | |
echo "Invalid URL"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment