Created
September 9, 2015 19:43
-
-
Save nielsenrc/fb2bc0fbfacf93b18141 to your computer and use it in GitHub Desktop.
PHP | Get Contents of Robots.txt File for a Text File of Domains
This file contains hidden or 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 | |
//Purpose to Check Contents of the Robots.txt File for a Series of Domains in a Local Text File | |
//define text file location | |
$old_url_text_file = "list.txt"; | |
//get contents of text file | |
$old_url_list = file_get_contents($old_url_text_file); | |
//process text file | |
$old_urls = explode("\n", $old_url_list); | |
$old_urls = array_filter(array_map('trim', $old_urls)); | |
//loop through text files | |
foreach($old_urls as $urls) { | |
//Define XML Data - In this Case - The Site to Be Parked | |
$domain = trim($urls); | |
//print results as table | |
print "<table>"; | |
print "<tr><td>" . $domain . "</td>" . "<td>" . file_get_contents($domain) . "</td></tr>" . "<br />"; | |
print "</table>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment