2010-05-06 2 views

답변

1

참고로, 여기서는 코드가 떨어져 있습니다. 이것은 일반적인 아이디어이지만 코드를 편집해야 할 수도 있습니다. 사실, 거의 확실합니다.

$fin = fopen('your zone file', 'r'); 
while (!feof($fin)) 
{ 
    $matches = array(); 
    $line = trim(fgets($fin)); 
    // only care about lines that are ip addresses or aliases 
    if (preg_match('/^(\S+)\s+((?:IN\s+)?)(A|AAAA|CNAME)\s+(\S+)$/i', $line, $matches)) 
    { 
     $subdomain = $matches[1]; 
     $ip_or_alias = $matches[4]; 
     do_something($subdomain, $ip_or_alias); 
    } 
} 
fclose($fin); 

정보를 취하여 어딘가에 저장하는 do_something 함수를 정의 할 수 있습니다. 또는 함수 호출이있는 곳에 바로 코드를 넣으십시오.

저장 방법은 해당 작업과 관련하여 많은 영향을받습니다.

관련 문제