1--TEST--
2array dns_get_record ( string $hostname [, int $type = DNS_ANY [, array &$authns [, array &$addtl [, bool &$raw = false ]]]] );
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
5--SKIPIF--
6<?php
7if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
8?>
9--FILE--
10<?php
11$hostname = "php.net";
12
13var_dump(is_array(dns_get_record($hostname)));
14var_dump(is_array(dns_get_record($hostname, DNS_A)));
15var_dump(is_array(dns_get_record($hostname, DNS_CNAME)));
16var_dump(is_array(dns_get_record($hostname, DNS_HINFO)));
17var_dump(is_array(dns_get_record($hostname, DNS_MX)));
18var_dump(is_array(dns_get_record($hostname, DNS_NS)));
19var_dump(is_array(dns_get_record($hostname, DNS_PTR)));
20var_dump(is_array(dns_get_record($hostname, DNS_SOA)));
21var_dump(is_array(dns_get_record($hostname, DNS_TXT)));
22var_dump(is_array(dns_get_record($hostname, DNS_AAAA)));
23var_dump(is_array(dns_get_record($hostname, DNS_SRV)));
24var_dump(is_array(dns_get_record($hostname, DNS_NAPTR)));
25var_dump(is_array(dns_get_record($hostname, DNS_A6)));
26var_dump(is_array(dns_get_record($hostname, DNS_ALL)));
27var_dump(is_array(dns_get_record($hostname, DNS_ANY)));
28
29dns_get_record($hostname, DNS_A, $authns_DNS_A);
30dns_get_record($hostname, DNS_CNAME, $authns_DNS_CNAME);
31dns_get_record($hostname, DNS_HINFO, $authns_DNS_HINFO);
32dns_get_record($hostname, DNS_MX, $authns_DNS_MX);
33dns_get_record($hostname, DNS_NS, $authns_DNS_NS);
34dns_get_record($hostname, DNS_PTR, $authns_DNS_PTR);
35dns_get_record($hostname, DNS_SOA, $authns_DNS_SOA);
36dns_get_record($hostname, DNS_TXT, $authns_DNS_TXT);
37dns_get_record($hostname, DNS_AAAA, $authns_DNS_AAAA);
38dns_get_record($hostname, DNS_SRV, $authns_DNS_SRV);
39dns_get_record($hostname, DNS_NAPTR, $authns_DNS_NAPTR);
40dns_get_record($hostname, DNS_A6, $authns_DNS_A6);
41dns_get_record($hostname, DNS_ALL, $authns_DNS_ALL);
42dns_get_record($hostname, DNS_ANY, $authns_DNS_ANY);
43
44var_dump(is_array($authns_DNS_A));
45var_dump(is_array($authns_DNS_CNAME));
46var_dump(is_array($authns_DNS_HINFO));
47var_dump(is_array($authns_DNS_MX));
48var_dump(is_array($authns_DNS_NS));
49var_dump(is_array($authns_DNS_PTR));
50var_dump(is_array($authns_DNS_SOA));
51var_dump(is_array($authns_DNS_TXT));
52var_dump(is_array($authns_DNS_AAAA));
53var_dump(is_array($authns_DNS_SRV));
54var_dump(is_array($authns_DNS_NAPTR));
55var_dump(is_array($authns_DNS_A6));
56var_dump(is_array($authns_DNS_ALL));
57var_dump(is_array($authns_DNS_ANY));
58
59dns_get_record($hostname, DNS_A, $authns_DNS_A, $addtl_DNS_A);
60dns_get_record($hostname, DNS_CNAME, $authns_DNS_CNAME, $addtl_DNS_CNAME);
61dns_get_record($hostname, DNS_HINFO, $authns_DNS_HINFO, $addtl_DNS_HINFO);
62dns_get_record($hostname, DNS_MX, $authns_DNS_MX, $addtl_DNS_MX);
63dns_get_record($hostname, DNS_NS, $authns_DNS_NS, $addtl_DNS_NS);
64dns_get_record($hostname, DNS_PTR, $authns_DNS_PTR, $addtl_DNS_PTR);
65dns_get_record($hostname, DNS_SOA, $authns_DNS_SOA, $addtl_DNS_SOA);
66dns_get_record($hostname, DNS_TXT, $authns_DNS_TXT, $addtl_DNS_TXT);
67dns_get_record($hostname, DNS_AAAA, $authns_DNS_AAAA, $addtl_DNS_AAAA);
68dns_get_record($hostname, DNS_SRV, $authns_DNS_SRV, $addtl_DNS_SRV);
69dns_get_record($hostname, DNS_NAPTR, $authns_DNS_NAPTR, $addtl_DNS_NAPTR);
70dns_get_record($hostname, DNS_A6, $authns_DNS_A6, $addtl_DNS_A6);
71dns_get_record($hostname, DNS_ALL, $authns_DNS_ALL, $addtl_DNS_ALL);
72dns_get_record($hostname, DNS_ANY, $authns_DNS_ANY, $addtl_DNS_ANY);
73
74var_dump(is_array($addtl_DNS_A));
75var_dump(is_array($addtl_DNS_CNAME));
76var_dump(is_array($addtl_DNS_HINFO));
77var_dump(is_array($addtl_DNS_MX));
78var_dump(is_array($addtl_DNS_NS));
79var_dump(is_array($addtl_DNS_PTR));
80var_dump(is_array($addtl_DNS_SOA));
81var_dump(is_array($addtl_DNS_TXT));
82var_dump(is_array($addtl_DNS_AAAA));
83var_dump(is_array($addtl_DNS_SRV));
84var_dump(is_array($addtl_DNS_NAPTR));
85var_dump(is_array($addtl_DNS_A6));
86var_dump(is_array($addtl_DNS_ALL));
87var_dump(is_array($addtl_DNS_ANY));
88
89var_dump(is_array(dns_get_record($hostname, DNS_A, $authns_DNS_A, $addtl_DNS_A, false)));
90var_dump(is_array(dns_get_record($hostname, DNS_CNAME, $authns_DNS_CNAME, $addtl_DNS_CNAME, false)));
91var_dump(is_array(dns_get_record($hostname, DNS_HINFO, $authns_DNS_HINFO, $addtl_DNS_HINFO, false)));
92var_dump(is_array(dns_get_record($hostname, DNS_MX, $authns_DNS_MX, $addtl_DNS_MX, false)));
93var_dump(is_array(dns_get_record($hostname, DNS_NS, $authns_DNS_NS, $addtl_DNS_NS, false)));
94var_dump(is_array(dns_get_record($hostname, DNS_PTR, $authns_DNS_PTR, $addtl_DNS_PTR, false)));
95var_dump(is_array(dns_get_record($hostname, DNS_SOA, $authns_DNS_SOA, $addtl_DNS_SOA, false)));
96var_dump(is_array(dns_get_record($hostname, DNS_TXT, $authns_DNS_TXT, $addtl_DNS_TXT, false)));
97var_dump(is_array(dns_get_record($hostname, DNS_AAAA, $authns_DNS_AAAA, $addtl_DNS_AAAA, false)));
98var_dump(is_array(dns_get_record($hostname, DNS_SRV, $authns_DNS_SRV, $addtl_DNS_SRV, false)));
99var_dump(is_array(dns_get_record($hostname, DNS_NAPTR, $authns_DNS_NAPTR, $addtl_DNS_NAPTR, false)));
100var_dump(is_array(dns_get_record($hostname, DNS_A6, $authns_DNS_A6, $addtl_DNS_A6, false)));
101var_dump(is_array(dns_get_record($hostname, DNS_ALL, $authns_DNS_ALL, $addtl_DNS_ALL, false)));
102var_dump(is_array(dns_get_record($hostname, DNS_ANY, $authns_DNS_ANY, $addtl_DNS_ANY, false)));
103
104var_dump(is_array(dns_get_record($hostname, DNS_A, $authns_DNS_A, $addtl_DNS_A, true)));
105var_dump(is_array(dns_get_record($hostname, DNS_CNAME, $authns_DNS_CNAME, $addtl_DNS_CNAME, true)));
106var_dump(is_array(dns_get_record($hostname, DNS_HINFO, $authns_DNS_HINFO, $addtl_DNS_HINFO, true)));
107var_dump(is_array(dns_get_record($hostname, DNS_MX, $authns_DNS_MX, $addtl_DNS_MX, true)));
108var_dump(is_array(dns_get_record($hostname, DNS_NS, $authns_DNS_NS, $addtl_DNS_NS, true)));
109var_dump(is_array(dns_get_record($hostname, DNS_PTR, $authns_DNS_PTR, $addtl_DNS_PTR, true)));
110var_dump(is_array(dns_get_record($hostname, DNS_SOA, $authns_DNS_SOA, $addtl_DNS_SOA, true)));
111var_dump(is_array(dns_get_record($hostname, DNS_TXT, $authns_DNS_TXT, $addtl_DNS_TXT, true)));
112var_dump(is_array(dns_get_record($hostname, DNS_AAAA, $authns_DNS_AAAA, $addtl_DNS_AAAA, true)));
113var_dump(is_array(dns_get_record($hostname, DNS_SRV, $authns_DNS_SRV, $addtl_DNS_SRV, true)));
114var_dump(is_array(dns_get_record($hostname, DNS_NAPTR, $authns_DNS_NAPTR, $addtl_DNS_NAPTR, true)));
115var_dump(is_array(dns_get_record($hostname, DNS_A6, $authns_DNS_A6, $addtl_DNS_A6, true)));
116var_dump(is_array(dns_get_record($hostname, DNS_ALL, $authns_DNS_ALL, $addtl_DNS_ALL, true)));
117var_dump(is_array(dns_get_record($hostname, DNS_ANY, $authns_DNS_ANY, $addtl_DNS_ANY, true)));
118?>
119--EXPECTF--
120bool(true)
121bool(true)
122bool(true)
123bool(true)
124bool(true)
125bool(true)
126bool(true)
127bool(true)
128bool(true)
129bool(true)
130bool(true)
131bool(true)
132bool(true)
133bool(true)
134bool(true)
135bool(false)
136bool(false)
137bool(false)
138bool(false)
139bool(false)
140bool(false)
141bool(false)
142bool(false)
143bool(false)
144bool(false)
145bool(false)
146bool(false)
147bool(false)
148bool(false)
149bool(false)
150bool(false)
151bool(false)
152bool(false)
153bool(false)
154bool(false)
155bool(false)
156bool(false)
157bool(false)
158bool(false)
159bool(false)
160bool(false)
161bool(false)
162bool(false)
163bool(true)
164bool(true)
165bool(true)
166bool(true)
167bool(true)
168bool(true)
169bool(true)
170bool(true)
171bool(true)
172bool(true)
173bool(true)
174bool(true)
175bool(true)
176bool(true)
177bool(true)
178bool(true)
179bool(true)
180bool(true)
181bool(true)
182bool(true)
183bool(true)
184bool(true)
185
186Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
187bool(false)
188
189Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
190bool(false)
191
192Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
193bool(false)
194
195Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
196bool(false)
197
198Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
199bool(false)
200
201Warning: dns_get_record(): Numeric DNS record type must be between %d and %d, '%s' given in %s on line %d
202bool(false)
203