<?php
dl("gopher.so");
$directory = file("gopher://gopher.example.com");
foreach($directory as $dirent){
print_r(gopher_parsedir($dirent));
}
/* Expected Output
---------------
Array (
[type] => 0
[title] => All about my gopher site.
[path] => /allabout.txt
[host] => gopher.example.com
[port] => 70
)
Array (
[type] => 9
[title] => A picture of my cat.
[path] => /pics/cat.png
[host] => gopher.example.com
[port] => 70
)
Array (
[type] => 1
[title] => A collection of my writings.
[path] => /stories
[host] => gopher.example.com
[port] => 70
)
Array (
[type] => 254
[title] => The HTTP version of this site.
[path] => URL:http://example.com
[host] => gopher.example.com
[port] => 70
)
Array (
[type] => 1
[title] => Mirror of this site in Spain.
[path] => /
[host] => gopher.ejemplo.co.es
[port] => 70
)
Array (
[type] => 255
[title] => Welcome to my gopher site.
[path] =>
[host] => error.host
[port] => 1
)
Array (
[type] => 255
[title] => Please select one of the options above.
[path] =>
[host] => error.host
[port] => 1
)
Array (
[type] => 255
[title] => Send complaints to /dev/null
[path] =>
[host] => error.host
[port] => 1
)
Array (
[type] => 255
[title] => Long live gopher!
[path] =>
[host] => error.host
[port] => 1
)
*/
?>