SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    troubleshooting domain script

    Hi all,

    I've been attempting to debug the script located on http://www.techdose.com/tutorials/php/domainNotify/ it seems the script out of the box has some minor issues when executed:

    Notice: Undefined variable: statusline in /var/www/html/capsite/domaincheck.php on line 39
    Notice: Undefined variable: expiration in /var/www/html/capsite/domaincheck.php on line 44
    Notice: Undefined offset: 1 in /var/www/html/capsite/domaincheck.php on line 46
    Notice: Undefined offset: 2 in /var/www/html/capsite/domaincheck.php on line 47

    The first two errors are obvious since the variables aren't defined. But the last two are out of my lead. I'm sure it has to do with the number array from the database but I haven't been able to figure it out quite yet. Any suggestions or help you can offer would be much appreciated since I'm tired of tracking my 60+ domains manually

    Thanks.

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by willywill View Post
    Notice: Undefined offset: 1 in /var/www/html/capsite/domaincheck.php on line 46
    Notice: Undefined offset: 2 in /var/www/html/capsite/domaincheck.php on line 47
    Undefined offsets generally refer to access array indexes that don't exist. For example, given an array:

    (1,2,3,4,5)

    Trying $array[10] will produce that particular notice. Unfortunately the pasted code and the one you have must be different because line 46 and 47 for me are an ending brace and a whitespace.

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply. I was adding and removing lines of code while posting. Here are the two lines that the error is referring to:

    $expiration_month = $expirationArr[1];
    $expiration_year = $expirationArr[2];

    The other strange part is that I had to redefine the variable for $expiration and $statusline, even though they were both defined in the previous parts of the code.

  4. #4
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, actually:

    Code PHP:
    exec('whois -h '.$whoisServer.' '.$domain,$whois,$error);
    foreach($whois as $whoisline){
        if(strstr($whoisline,"Expiration")){
            $whoisline = str_replace("Expiration Date:","",$whoisline);
            $whoisline = trim($whoisline);
            $expiration = substr($whoisline,0,11);
        }
     
        if(strstr($whoisline,"Status")){
            $statusline = $whoisline;
        }
    }

    This is conditionally based. Unfortunately, this script assumes that whois is successfully executed every time. In the event that there is no $whois (ie. no output or an error instead), $expiration and $statusline will be undefined when accessed by the code below. I'd see what exactly the output of $whois is before the loop, so you have an idea of what's being returned.


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
  •