PHP Classes

File: test/client_example.php

Recommend this page to a friend!
  Classes of Cesar D. Rodas   File Exchange Protocol   test/client_example.php   Download  
File: test/client_example.php
Role: Example script
Content type: text/plain
Description: Client Example
Class: File Exchange Protocol
Store and retrieve remote files using HTTP
Author: By
Last change: Accessible without user login
Date: 16 years ago
Size: 2,781 bytes
 

Contents

Class file image Download
<html>
<head>
    <title>Tesgin FEP</title>
</head>
<body>
<?php
/***************************************************************************
 * Copyright (C) 2007 by Cesar D. Rodas *
 * crodas@cnc.una.py *
 * *
 * Permission is hereby granted, free of charge, to any person obtaining *
 * a copy of this software and associated documentation files (the *
 * "Software"), to deal in the Software without restriction, including *
 * without limitation the rights to use, copy, modify, merge, publish, *
 * distribute, sublicense, and/or sell copies of the Software, and to *
 * permit persons to whom the Software is furnished to do so, subject to *
 * the following conditions: *
 * *
 * The above copyright notice and this permission notice shall be *
 * included in all copies or substantial portions of the Software. *
 * *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR *
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
 * OTHER DEALINGS IN THE SOFTWARE. *
 ***************************************************************************/
require("FEP_client.php");
set_time_limit(100);
error_reporting(E_ALL);

/* Defining setting */
define('FEP_USER','cesar'); /*username*/
define('FEP_PASS','rasec'); /*password */
define('FEP_SERVER','http://localhost/fep/test/server_example.php');
 
/*server URL, you must change this*/
$str='';
for(
$i=0; $i < 10000; $i++)
   
$str.="$i. PHP Rulz<br/>\n";
?>
<h1>File Exchange Protocol</h1>
<h2>Creating Directory</h2>
<?php mkdir("fep://php"); ?>
<hr />
<h2>Creating file</h2>
<?php file_put_contents("fep://php/readme",$str); ?>
<hr />
<h2>Opening file</h2>
<?php echo file_get_contents("fep://php/readme"); ?>
<hr />
<h2>Opening a folder</h2>
<?php $f=opendir("fep://php/");
while (
$r=readdir($f) ) {
    echo
$r."<br/>";
}
closedir($f);?>
<hr />
<h2>Deleting file</h2>
<?php unlink("fep://php/readme"); ?>
<hr />
<h2>Deleting folder</h2>
<?php rmdir("fep://php");?>
</body>
</html>