![]() Use udaljonnykh/remote files If support " URL fopen-obolochki/wrapper " is switched on at konfigurirovanii PHP (if you only have not passed in the obvious image a flag - disable-url-fopen-wrapper for konfigurirovanija (for versions, novee 4.0.3) or have not established allow_url_fopen in off in a file php.ini (for newer versions)), you can use HTTP and FTP-URL'HH with the majority of functions which accept a filename/name of a file as parameter, including - operators require () and include (). The note: Windows-version PHP now does not support the removed access to files for the following functions: include (), include_once (), require () require_once (). For example, you can use it to open a file on the removed web-server, to disassemble a conclusion of the data, and then to use these data in search to a DB or simply to deduce{remove} them in style of your web-site. Example: Reception of the name / title of the removed page <? php $file = fopen ("http://www.example.com/", "r"); if (! $file) { echo " <p> Unable to open remote file. "; exit; } while (! feof ($file)) { $line = fgets ($file, 1024); /* It will work, only if title and his tags are located in one line */ if (eregi (" <title> (. *) </title> ", $line, $out)) { $title = $out [1]; break; } } fclose ($file); ?> You can write down also in files on FTP if are connected as the user to correct access rights and if the file does not exist yet. For connection as any user, except for ' anonymous ', it is necessary for you to specify username (and, probably, password) in URL, as, for example: ' ftp: // user:password@ftp.example.com/path/to/file '. (you can use the same syntax for access to files on HTTP if it is necessary Basic-autentifikacija.) Example: Preservation of the data on the removed server <? php $file = fopen ("ftp://ftp.example.com/incoming/outputfile", "w"); if (! $file) { echo " <p> Unable to open remote file for writing. "; exit; } /* The data here enter the name. */ fputs ($file, $ _SERVER [' HTTP_USER_AGENT ']. " "); fclose ($file); ?> The note: from this example you can have idea to use this technics{technical equipment} for recording in removed log, but as it mentioned above, you can write down only in a new file with use of URL fopen shells (). For performance distributed{allocated} loginga, like it, you should see{overlook} syslog (). | |