-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_datastorage.php
37 lines (31 loc) · 2.17 KB
/
example_datastorage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?
/* ------------------------------------------------------------------------------------------
Exemplary use/ implementation of PHP Class "datastorage"
Purpose: Provide an exemplary use of the the class "datastorage" (based on configuration)
Context: It is assumed that there is an FTP server that contains data about retailers
// --------------------------------------------------------------------------------------- */
// ------------------------------------------------------------------------------------------
// Import class "datastorage"
// ------------------------------------------------------------------------------------------
require_once 'class_datastorage.php';
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// Read rawdata into variable (e.g. by using CURL() operations) and define target filename
// ------------------------------------------------------------------------------------------
$rawdata = "Super Crazy Rawdata about a retailer --- 1234567 \n <br>";
$targetfile = "filename_to_be_used_for_storing.txt"
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// Create new object "datastorage"
// ------------------------------------------------------------------------------------------
$storage_type = "fileserver";
$storage_name = "retailer";
$data_type = "rawdata";
$datastorage = new datastorage($storage_type, $storage_name, $data_type);
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// Store data in datastorage
// ------------------------------------------------------------------------------------------
$storedata = $datastorage->storeData($rawdata, $targetfile);
// ------------------------------------------------------------------------------------------
?>