PHP 4

[ PHP ]

(!!! Teleportom!!!)
: fopen, msql_num_fields, socket_write ...


20. /remote

"URL fopen-/wrapper" PHP ( --disable-url-fopen-wrapper ( , 4.0.3) allow_url_fopen off php.ini ( )), HTTP FTP- URL' , filename/ , - require() include().

: Windows- PHP : include(), include_once(), require() require_once().

, , web-, , web-.

20-1. /title
<?php
$file = fopen ("http://www.example.com/", "r");
if (!$file) {
    echo "<p>Unable to open remote file.\n";
    exit;
}
while (!feof ($file)) {
    $line = fgets ($file, 1024);
    /*   ,   title        */
    if (eregi ("<title>(.*)</title>", $line, $out)) {
        $title = $out[1];
        break;
    }
}
fclose($file);
?>

FTP, . , 'anonymous', username (, , password) URL, , : 'ftp://user:[email protected]/path/to/file'. ( HTTP, Basic-.)

20-2.
<?php
$file = fopen ("ftp://ftp.example.com/incoming/outputfile", "w");
if (!$file) {
    echo "<p>Unable to open remote file for writing.\n";
    exit;
}
/*   . */
fputs ($file, $_SERVER['HTTP_USER_AGENT'] . "\n");
fclose ($file);
?>

: log, , , URL fopen(). , , syslog().


PUT
css

: 3119 .

: - |  -