PHP implements the checkdnsrr function of the window platform_PHP tutorial

WBOY
Release: 2016-07-13 09:52:25
Original
721 people have browsed it

php implements the checkdnsrr function of the window platform

This article mainly introduces the checkdnsrr function of the window platform implemented by php. PHP’s own checkdnsrr function is only valid on the linux platform. This article will A checkdnsrr function that can be used under window has been simulated. Friends who need it can refer to it

PHP’s built-in checkdnsrr function is only valid on the Linux platform. If you are used to using it and it cannot be used on the window platform, it will cause trouble for compatibility.

Therefore, I wrote a checkdnsrr simulation function to be used in the window platform environment.

 ?

1

2

3

4

5

6

7

8

9

10

11

12

13

if (!function_exists('checkdnsrr ')) {

function checkdnsrr($host, $type) {

if(!empty($host) && !empty($type)) {

@exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output);

foreach ($output as $k => $line) {

if(eregi('^' . $host, $line)) {

return true;

}

}

}

return false;

}

}

1 2

34 5 6 7 8 9
10
11
12 13
if (!function_exists('checkdnsrr ')) { function checkdnsrr($host, $type) { if(!empty($host) && !empty($type)) { @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); foreach ($output as $k => $line) { if(eregi('^' . $host, $line)) { return true; } } } return false; } }
http://www.bkjia.com/PHPjc/1007654.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1007654.htmlTechArticlephp implements the checkdnsrr function of the window platform. This article mainly introduces the checkdnsrr function of the window platform implemented by php, PHP's automatic The function with checkdnsrr is only valid on the Linux platform. This article simulates...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template