note 115561 deleted from function.dns-get-record by salathe
| From: | salathe@php.net | Date: | Fri, 22 Aug 2014 08:12:29 +0000 |
| Subject: | note 115561 deleted from function.dns-get-record by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200271@lists.php.net to get a copy of this message | ||
Note Submitter: John
----
A quick'n dirty example for a email service lookup
<?php
$email = "foo.bar@gmail.com";
$domain = substr(strrchr($email,'@'),1);
foreach (["imap","imaps","pop3","pop3s"] as $s) {
$record = dns_get_record('_'.$s.'._tcp.'.$domain, DNS_SRV);
foreach ($record as $r) {
if (empty($r['target'])) continue;
echo $s ." @ ".$r['target'].':'.$r['port'].PHP_EOL;
}
}