Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
Quick foreach loop from text file question.
Old 06-16-2010, 06:29 AM Quick foreach loop from text file question.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Hi guys, I hope someone can quickly show me how to do :

ive got a list of domains in a .txt file

blaa.com
moo.com
test.com
etc.com
etc.com
etc.com

How can i get a php script to quickly run though this list and do a NSlookup ( or a dig ) to see what the nameservers are for the domains.

I need to check a massive list of domains and check where the nameservers are ( so i can can up stuff not pointing to my dns. )

I would assume something like:

foreach (domains.txt) {
host -t ns $domain;
echo "Doing $domain<br>";
echo $nameservers;
}

So it can print the Nameservers for each domain?

Any thoughts?

im hoping this may be a really easy script for a more advanced php programmer.

Thanks
Graham
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
View Public Profile Visit lynxus's homepage!
 
 
Register now for full access!
Old 06-16-2010, 07:13 AM Re: Quick foreach loop from text file question.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Decided to do it like:

<?php

$filename = "domains.txt";
$linenum = "0";

$fp = fopen($filename,'r');
while($line=fgets($fp)) {


$ns = exec("host -t NS $line");
echo "$ns \n";

} fclose($fp);

?>



Please close thread or delete.

Thanks
G
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
View Public Profile Visit lynxus's homepage!
 
Old 06-16-2010, 07:43 AM Re: Quick foreach loop from text file question.
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
Nice to see somone post the solution rather than just say "solved" hehe.
__________________

Please login or register to view this content. Registration is FREE

Learn professional skills from professional people, from $6.50 a month.
Phunk Rabbit is offline
View Public Profile Visit Phunk Rabbit's homepage!
 
Closed Thread     « Reply to Quick foreach loop from text file question.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11409 seconds with 12 queries