SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2001
    Location
    michigan
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    store output of a passthru() in a variable?

    passthru("whois sitepointforums.com");

    will spit out:

    Whois Server Version 1.3 Domain names in the .com, .net, and .org domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. Domain Name: SITEPOINTFORUMS.COM Registrar: ENOM, INC. Whois Server: whois.enom.com Referral URL: http://www.enom.com Name Server: NS2.RACKSPACE.COM Name Server: NS.RACKSPACE.COM Updated Date: 12-jul-2001 >>> Last update of whois database: Sat, 6 Oct 2001 05:40:16 EDT <<< The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and Registrars.

    -----------------------------

    I need to store that into a variable. Like say $info

    $info = passthru("whois sitepointforums.com");

    will only spit out the info again and not store anything in the variable, sicne passthru executes an external program.

    Is there anyway to store the stuff passthru() spits out into a variable, and not have it spit out anything to the user?
    -spoon
    CEO nexdot.net
    -spoonified.com

  2. #2
    SitePoint Member
    Join Date
    Sep 2001
    Location
    michigan
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    n/m

    found a way to do it .

    just incase anyone else needs to know:
    PHP Code:
    <?  
    unset($blah);
    exec("whois sitepointforums.com"$blah);


    for(
    $i=0,$n=count($blah); $i<$n$i++)
    {
    print 
    "$i - $blah[$i]<br>";
    }
    ?>
    use that to see the whois. but in my case, i dont want to see it, so i used below:

    PHP Code:
    <?
    unset($blah);
    exec("whois sitepointforums.com"$blah);
    ?>
    Then, in my case, i just need to check $blah[6] (line 7) to check for either:

    Domain Name:
    No Match
    or anything else

    that would allow me to say that domain existed, it didnt, or i didnt get a clear answer.


    I chose this over checkdnsr because it wasnt 100% accurate since some domains are registered and have NO DNS Entries.
    -spoon
    CEO nexdot.net
    -spoonified.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •