Question

The aim of my project is to create a bulk WHOIS checker which outputs select information from multiple whois records.

I think I'm quite close to finishing it there is just an annoying bug which I can't figure out. (It's probabaly something really simple)

My code is as follows;

    $domain = explode("\r\n", $domains);

    print_r($domain);
    echo "<br /><br />";


    foreach ($domain as $item) {

        fwrite($fp, $item . "\r\n");

        while (!feof($fp)) {
            $lookup .= fread($fp, 8192);
        }

        $value = explode("\r\n\r\n", $lookup);
                    $whois_data = array();


        foreach ($value as $values) {
            $details = explode(":\r\n", $values, 2);
            $whois_data[trim($details[0])] = $details[1];
        }

        echo "Show WHOIS data for " . $item . "<br />";
        print_r($whois_data);
        unset($whois_data);
        echo "<br /><br />";
    }

$domains is a textarea box with one domain per line, my output from this PHP is as follows;

Array ( [0] => madeupdomainname.co.uk [1] => anothermadeupdomain.co.uk )

Show WHOIS data for madeupdomainname.co.uk

Array ( [Domain name] => madeupdomainname.co.uk [Registrant] => Made Up Inc. [Registrant type] => Unknown [Registrant's address] => 123 Fake Road City UK [Registrar] => Made Up Inc. t/a Made Up [Tag = MADEUP] URL: madeupdomainname.co.uk [Relevant dates] => Registered on: 14-Feb-1929 Renewal date: 11-Feb-2023 Last updated: 12-Feb-2031 [Registration status] => Registered until renewal date. [Name servers] => ns1.madeupdomainname.co.uk ns2.madeupdomainname.co.uk ns3.madeupdomainname.co.uk ns4.madeupdomainname.co.uk [WHOIS lookup made at 01:09:24 08-Dec-2011] => [-- This WHOIS information is provided for free by Nominet UK the central registry for .uk domain names. This information and the .uk WHOIS are:] => [Copyright Nominet UK 1996 - 2011.] => [You may not access the .uk WHOIS or use any data from it except as permitted by the terms of use available in full at nominet.org.uk/whois, which includes restrictions on: (A) use of the data for advertising, or its repackaging, recompilation, redistribution or reuse (B) obscuring, removing or hiding any or all of this notice and (C) exceeding query rate or volume limits. The data is provided on an 'as-is' basis and may lag behind the register. Access may be withdrawn or restricted at any time.] => )

Show WHOIS data for anothermadeupdomain.co.uk

Array ( [Domain name] => madeupdomainname.co.uk [Registrant] => Made Up Inc. [Registrant type] => Unknown [Registrant's address] => 123 Fake Road City UK [Registrar] => Made Up Inc. t/a Made Up [Tag = MADEUP] URL: madeupdomainname.co.uk [Relevant dates] => Registered on: 14-Feb-1929 Renewal date: 11-Feb-2023 Last updated: 12-Feb-2031 [Registration status] => Registered until renewal date. [Name servers] => ns1.madeupdomainname.co.uk ns2.madeupdomainname.co.uk ns3.madeupdomainname.co.uk ns4.madeupdomainname.co.uk [WHOIS lookup made at 01:09:24 08-Dec-2011] => [-- This WHOIS information is provided for free by Nominet UK the central registry for .uk domain names. This information and the .uk WHOIS are:] => [Copyright Nominet UK 1996 - 2011.] => [You may not access the .uk WHOIS or use any data from it except as permitted by the terms of use available in full at nominet.org.uk/whois, which includes restrictions on: (A) use of the data for advertising, or its repackaging, recompilation, redistribution or reuse (B) obscuring, removing or hiding any or all of this notice and (C) exceeding query rate or volume limits. The data is provided on an 'as-is' basis and may lag behind the register. Access may be withdrawn or restricted at any time.] => )

As you can see it's grabbing the WHOIS data from the first domain correctly but then ignoring the second domain and just re using the first domains WHOS information which is really bugging me. Any suggestions?

Thanks.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top