2012-06-05 5 views
-1

누구나 "Class 'Whois'not found"오류가 발생하는 이유를 알려주십시오. 그것은 라인 $whois = new Whois();과 관련이 있습니다. 그러나 나는 무엇이 확실하지 않습니다.문제 해결 "클래스를 찾을 수 없음"오류

<form method="post" action=""> 
    <div style="margin:auto;width:300px;"> 
    <label for="domain name">Domain Check:</label><br /> 
    <input type="text" name="domain" /><br /><br /> 
    <input type="submit" /> 
</form> 
<br /> 
<?php 
if (isset($_REQUEST['domain'])) { // check to see if form has been submitted 
function getwhois($domain, $tld) 
{ 
require_once("whois.class.php"); 

$whois = new Whois(); 

if(!$whois->ValidDomain($domain.'.'.$tld)){ 
    return 'Sorry, the domain is not valid or not supported.'; 
    } 

if($whois->Lookup($domain.'.'.$tld)){ 
    return $whois->GetData(1); 
    }else{ 
    return 'Sorry, an error occurred.'; 
    } 
} 

$domain = trim($_REQUEST['domain']); 

$dot = strpos($domain, '.'); 
$sld = substr($domain, 0, $dot); 
$tld = substr($domain, $dot+1); 

$whois = getwhois($sld, $tld); 

echo " 

"; 
echo $whois; 
echo " 
"; 
} 
?> 
</div> 
+2

whois.class.php의 새로운 기능에서이를로드하고 있는지 확인? –

+0

var_dump (file_exists ("whois.class.php")); –

+1

인터넷에서 사용하려고하는 Whois 클래스를 발견했습니다. : P 그리고 그것은 다음을 포함해야합니다 : http://www.nott.org/uploads/whois.class.php.txt 실제로 그 것을 포함하고 있습니까, 아니면 비어 있습니까? ... –

답변

0

당신이 바로 그 디렉토리

require_once("whois.class.php"); 
+0

whois.class.php는이 파일과 동일한 디렉토리에 있습니다 – Nick5a1

+1

클래스를 요구하기 전에'function getwois ($ domain, $ tld)'를 호출하고 있습니다. @ 대니얼 (Daniel)의 말처럼, 요구 사항을 맨 위로 옮겨보십시오. –

+0

'if (isset ($ _REQUEST [ 'domain']))')가 참일 때 오류가 발생합니까? –

0

나는 파일의 상단으로 require_once을 이동해야한다고 생각합니다.

+0

여전히 동일한 오류가 발생합니다 – Nick5a1

관련 문제