9
'http://64.246.30.37/',
19
'http://www.php.net/',
21
'http://www.php.net:80',
22
'http://www.php.net:80/',
23
'http://www.php.net/index.php',
26
'http://www.php.net/?',
27
'http://www.php.net:80/?',
28
'http://www.php.net:80/index.php',
29
'http://www.php.net:80/foo/bar/index.php',
30
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
31
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5',
32
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
33
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
34
'http://www.php.net:80/this/../a/../deep/directory',
35
'http://www.php.net:80/this/../a/../deep/directory/',
36
'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
37
'http://www.php.net:80/index.php',
38
'http://www.php.net:80/index.php?',
39
'http://www.php.net:80/#foo',
40
'http://www.php.net:80/?#',
41
'http://www.php.net:80/?test=1',
42
'http://www.php.net/?test=1&',
43
'http://www.php.net:80/?&',
44
'http://www.php.net:80/index.php?test=1&',
45
'http://www.php.net/index.php?&',
46
'http://www.php.net:80/index.php?foo&',
47
'http://www.php.net/index.php?&foo',
48
'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
49
'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
50
'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
51
'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
52
'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
53
'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
54
'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
55
'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
56
'nntp://news.php.net',
57
'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
58
'zlib:http://foo@bar',
60
'zlib:/path/to/my/file/file.txt',
62
'mailto:me@mydomain.com',
65
'http://user:passwd@www.example.com:8080?bar=1&boom=0',
66
'file:///path/to/file',
67
'file://path/to/file',
69
'http://1.2.3.4:/abc.asp?a=1&b=2',
72
'foo+bar://baz@bang/bla',
75
foreach ($sample_urls as $url) {
76
var_dump(@parse_url($url));
86
string(12) "64.246.30.37"
92
string(12) "64.246.30.37"
98
string(12) "64.246.30.37"
104
string(13) "64.246.30.37/"
108
string(12) "64.246.30.37"
138
string(11) "www.php.net"
142
string(12) "www.php.net/"
148
string(11) "www.php.net"
154
string(11) "www.php.net"
160
string(11) "www.php.net"
168
string(11) "www.php.net"
176
string(11) "www.php.net"
186
string(11) "www.php.net"
188
string(10) "/index.php"
192
string(12) "www.php.net/"
196
string(11) "www.php.net"
206
string(11) "www.php.net"
214
string(11) "www.php.net"
224
string(11) "www.php.net"
228
string(10) "/index.php"
234
string(11) "www.php.net"
238
string(18) "/foo/bar/index.php"
244
string(11) "www.php.net"
248
string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
254
string(11) "www.php.net"
258
string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
260
string(37) "lots=1&of=2¶meters=3&too=4&here=5"
266
string(11) "www.php.net"
270
string(45) "/this/is/a/very/deep/directory/structure/and/"
276
string(11) "www.php.net"
280
string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
286
string(11) "www.php.net"
290
string(28) "/this/../a/../deep/directory"
296
string(11) "www.php.net"
300
string(29) "/this/../a/../deep/directory/"
306
string(11) "www.php.net"
310
string(42) "/this/is/a/very/deep/directory/../file.php"
316
string(11) "www.php.net"
320
string(10) "/index.php"
326
string(11) "www.php.net"
330
string(10) "/index.php"
336
string(11) "www.php.net"
348
string(11) "www.php.net"
358
string(11) "www.php.net"
370
string(11) "www.php.net"
380
string(11) "www.php.net"
392
string(11) "www.php.net"
396
string(10) "/index.php"
404
string(11) "www.php.net"
406
string(10) "/index.php"
414
string(11) "www.php.net"
418
string(10) "/index.php"
426
string(11) "www.php.net"
428
string(10) "/index.php"
436
string(11) "www.php.net"
440
string(10) "/index.php"
442
string(31) "test=1&test2=char&test3=mixesCI"
446
string(11) "www.php.net"
450
string(10) "/index.php"
452
string(31) "test=1&test2=char&test3=mixesCI"
454
string(16) "some_page_ref123"
460
string(11) "www.php.net"
466
string(10) "/index.php"
468
string(31) "test=1&test2=char&test3=mixesCI"
470
string(16) "some_page_ref123"
476
string(11) "www.php.net"
480
string(10) "/index.php"
482
string(31) "test=1&test2=char&test3=mixesCI"
484
string(16) "some_page_ref123"
490
string(11) "www.php.net"
496
string(10) "/index.php"
498
string(31) "test=1&test2=char&test3=mixesCI"
500
string(16) "some_page_ref123"
506
string(11) "www.php.net"
512
string(10) "/index.php"
514
string(31) "test=1&test2=char&test3=mixesCI"
516
string(16) "some_page_ref123"
522
string(19) "hideout@www.php.net"
528
string(10) "/index.php"
530
string(31) "test=1&test2=char&test3=mixesCI"
532
string(16) "some_page_ref123"
538
string(11) "www.php.net"
546
string(10) "/index.php"
548
string(31) "test=1&test2=char&test3=mixesCI"
550
string(16) "some_page_ref123"
556
string(12) "news.php.net"
562
string(11) "ftp.gnu.org"
564
string(22) "/gnu/glic/glibc.tar.gz"
570
string(14) "http://foo@bar"
576
string(12) "filename.txt"
582
string(25) "/path/to/my/file/file.txt"
596
string(15) "me@mydomain.com"
614
string(15) "www.example.com"
622
string(12) "bar=1&boom=0"
628
string(13) "/path/to/file"
642
string(13) "/path/to/file"