LII. Net_Gopher

Introduzione

The gopher protocol, as defined by RFC 1436, is generally considered the ancestor of the modern HTTP protocol. However, gopher was also intended to provide references to non-gopher resources including telnet, wais, nntp, and even http. This extension adds gopher support to PHP's URL Wrappers, and provides a helper function gopher_parsedir() to make sense of gopher formatted directory listings.

Installazione

Net_Gopher is installed through the usual PECL package installation process.

  • Prerequisite: PHP 4.3.0.

  • $ pear install Net_Gopher

  • Copy the resulting gopher.so to an appropriate location and add extension=gopher.so to your php.ini file or load it dynamically in your PHP script using dl("gopher.so");

Configurazione di Runtime

Questa estensione non definisce alcuna direttiva di configurazione in php.ini

Tipi di risorse

Questa estensione non definisce alcun tipo di risorsa.

Costanti predefinite

Queste costanti sono definite da questa estensione e sono disponibili solo se l'estensione è stata compilata nel PHP o se è stata caricata dinamicamente a runtime.

Tabella 1. Net_Gopher constants

ConstantValueDescription
GOPHER_DOCUMENT0Standard text/plain document.
GOPHER_DIRECTORY1A resource containing a gopher formatted directory listing.
GOPHER_BINHEX4A BinHex encoded binary file.
GOPHER_DOSBINARY5A DOS formatted binary archive.
GOPHER_UUENCODED6A UUEncoded file.
GOPHER_BINARY9A generic binary file.
GOPHER_INFO255An Informational entry
GOPHER_HTTP254A reference to an HTTP resource.
GOPHER_UNKNOWN-1 An unrecognized entry.

Esempi

<?php
readfile
("gopher://gopher.example.com/somedocument");
?>

Sommario
gopher_parsedir -- Translate a gopher formatted directory entry into an associative array.