当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_DNS_Resolver::search方法代码示例

本文整理汇总了PHP中Net_DNS_Resolver::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_DNS_Resolver::search方法的具体用法?PHP Net_DNS_Resolver::search怎么用?PHP Net_DNS_Resolver::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_DNS_Resolver的用法示例。


在下文中一共展示了Net_DNS_Resolver::search方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: olc_get_ip_info

function olc_get_ip_info(&$smarty)
{
    if (SHOW_IP_LOG == TRUE_STRING_S) {
        $customers_ip_text = 'CUSTOMERS_IP';
        $ip = $_SESSION[$customers_ip_text];
        if (!isset($ip)) {
            $ip = $_SERVER['REMOTE_ADDR'];
            if (strlen($ip) > 0) {
                if (function_exists("gethostbyaddr")) {
                    //Get host-name for IP by built-in PHP-function
                    $host = gethostbyaddr($ip);
                }
                if (strlen($host) == 0) {
                    //"gethostbyaddr" does not work always, so try "Net_DNS" first
                    define('FILENAME_NET_DNS', '"Net/DNS.php');
                    if (file_exists(FILENAME_NET_DNS)) {
                        require_once FILENAME_NET_DNS;
                        $res = new Net_DNS_Resolver();
                        $ans = $res->search($ip, "MX");
                        if ($ans) {
                            $host = $ans->answer[0]->ptrdname;
                        }
                    }
                }
                if (strlen($host) > 0) {
                    if ($host != $ip) {
                        $ip .= LPAREN . $host . RPAREN;
                    }
                }
                $ip .= ' -- Datum: ' . date("d.m.Y H:i:s");
                $_SESSION[$customers_ip_text] = $ip;
            }
        }
        if ($smarty) {
            $smarty->assign('IP_LOG', true);
            $smarty->assign($customers_ip_text, $ip);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:39,代码来源:145.php

示例2: getdnsattributes

function getdnsattributes($l, $ip)
{
    $r = new Net_DNS_Resolver();
    $r->nameservers = array("ws1.maxmind.com");
    $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN");
    $str = is_object($p->answer[0]) ? $p->answer[0]->string() : '';
    ereg("\"(.*)\"", $str, $regs);
    $str = $regs[1];
    return $str;
}
开发者ID:heshuai64,项目名称:gamestore,代码行数:10,代码来源:geoip.php

示例3: getdnsattributes

 public function getdnsattributes($l, $ip)
 {
     $r = new Net_DNS_Resolver();
     $r->nameservers = array("ws1.maxmind.com");
     $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN");
     $str = is_object($p->answer[0]) ? $p->answer[0]->string() : '';
     $str = substr($str, 1, -1);
     return $str;
 }
开发者ID:nathanlon,项目名称:Maxmind-GeoIp,代码行数:9,代码来源:GeoIp.php

示例4: Resolve

 /**
  * @brief Resolve a LSID using the DNS
  *
  * 
  */
 function Resolve($lsid_to_resolve)
 {
     $result = true;
     $this->lsid = new LSID($lsid_to_resolve);
     $ndr = new Net_DNS_Resolver();
     $answer = $ndr->search("_lsid._tcp." . $this->lsid->getAuthority(), "SRV");
     if ($answer == false) {
         $result = false;
     } else {
         if ($this->debug) {
             echo "<pre>";
             print_r($answer->answer);
             echo "</pre>";
         }
     }
     $this->server = $answer->answer[0]->target;
     $this->port = $answer->answer[0]->port;
     if ($this->report) {
         echo "<p>";
         echo "Authority for <strong>{$lsid_to_resolve}</strong> ";
         if ($result) {
             echo "is located at: ", $this->server, ":", $this->port;
         } else {
             echo "not found";
         }
         echo "</p>";
     }
     return $result;
 }
开发者ID:rdmpage,项目名称:bioguid,代码行数:34,代码来源:class_lsid.php

示例5: nameservers

 /**
  * Gets or sets the nameservers to be queried.
  *
  * Returns the current nameservers if an array of new nameservers is not
  * given as the argument OR sets the nameservers to the given nameservers.
  *
  * Nameservers not specified by ip address must be able to be resolved by
  * the default settings of a new Net_DNS_Resolver.
  *
  * @access public
  */
 function nameservers($nsa = array())
 {
     $defres = new Net_DNS_Resolver();
     if (is_array($nsa)) {
         $a = array();
         foreach ($nsa as $ns) {
             if (preg_match('/^(\\d+(:?\\.\\d+){0,3})$/', $ns)) {
                 $a[] = $ns == 0 ? '0.0.0.0' : $ns;
             } else {
                 $names = array();
                 if (!preg_match('/\\./', $ns)) {
                     if (!empty($defres->searchlist)) {
                         foreach ($defres->searchlist as $suffix) {
                             $names[] = $ns . '.' . $suffix;
                         }
                     } elseif (!empty($defres->domain)) {
                         $names[] = $ns . '.' . $defres->domain;
                     }
                 } else {
                     $names[] = $ns;
                 }
                 $packet = $defres->search($ns);
                 if (is_object($packet)) {
                     $addresses = $this->cname_addr($names, $packet);
                     foreach ($addresses as $b) {
                         $a[] = $b;
                     }
                     $a = array_unique($a);
                 }
             }
         }
         if (count($a)) {
             $this->nameservers = $a;
         }
     }
     return $this->nameservers;
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:48,代码来源:Resolver.php

示例6: getdnsattributes_VMWO

function getdnsattributes_VMWO($l, $ip)
{
    $r = new Net_DNS_Resolver();
    $r->nameservers = array("ws1.maxmind.com");
    $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN");
    $str = is_object($p->answer[0]) ? $p->answer[0]->string() : '';
    //ereg("\"(.*)\"",$str,$regs); // mike challis PHP5.3 fix
    preg_match("/\"(.*)\"/", $str, $regs);
    $str = isset($regs[1]) ? $regs[1] : '';
    return $str;
}
开发者ID:sdgdsffdsfff,项目名称:html-sensor,代码行数:11,代码来源:geoipcity.inc.php


注:本文中的Net_DNS_Resolver::search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。