exec() output gives weird error due to URL being in output

Discussion in 'PHP' started by relixx, Nov 5, 2008.

  1. #1
    Hi all,

    Ok, I'm debugging a PHP script that does whois lookups. Now, all goes well until it does a specific domain lookup (.co.za domains). When I do that, I get the following:

    
    Whois results for google.co.za
    
    	 	 	[Querying http://whois.co.za/cgi-bin/whois.sh]
    /root/: No such directory
    
    
    
    Code (markup):
    The proper output (when done via command line) is similar to this:

    
    whois google.co.za
    [Querying http://whois.co.za/cgi-bin/whois.sh]
    
                           The CO.ZA simple whois server
                              © Copyright UniForum SA
             Use of this facility subject to the [1]terms of site usage
    
       Your query has generated the following reply:-
    
    Search on google (.co.za)
    Match: One
    
    Domain: google.co.za
    etc, etc, etc
    
    Code (markup):
    Now, while other Whois results return urls in the body, it's always something like http://www.markmonitor.com.

    Has anyone encountered this problem before? /root/ does naturally exist, but there's no way in hell I'm letting anything have access to that directory...
     
    relixx, Nov 5, 2008 IP
  2. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #2
    I have exec() disabled and can not test. But it seems it depends on folder permissions, look at this thread.

    I would recommend to use Net_Whois instead of exec() or just scraping whois web interface pages.
     
    wmtips, Nov 5, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    Or try to connect to the URL and fetch information, there are alot of examples online!
     
    EricBruggema, Nov 7, 2008 IP
  4. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #4
    It's purely an output problem, I've been working on it and it seems to be related to permissions. no matter what I do, even stuff like directing the output to a file or running the whois within a shell script, the same result occurs whenever I query a .co.za domain, and only then :/

    Even if I grep -v the URL at the beginning of the output, its the same result.
     
    relixx, Nov 7, 2008 IP