SRV record lookup with PHP

前端 未结 2 1780
面向向阳花
面向向阳花 2021-01-21 04:48

If you type

nslookup -type=SRV _xmpp-server._tcp.gmail.com

(or use the dig command in OSX) you get some SRV records relating to google chat

2条回答
  •  孤街浪徒
    2021-01-21 05:18

    You could use Pear Net_DNS. I managed to get this to work on Linux, but haven't tested it on Windows or any others:

    require_once('Net/DNS.php');
    $resolver = new Net_DNS_Resolver();
    $response = $resolver->query('_xmpp-server._tcp.gmail.com', 'SRV');
    if ($response) {
        foreach ($response->answer as $rr) {
            $rr->display();
        }
    }
    

    I modified the example from their documentation. hope this helps

提交回复
热议问题