-
Notifications
You must be signed in to change notification settings - Fork 0
/
R-CRUD.php
29 lines (25 loc) · 828 Bytes
/
R-CRUD.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
<?php
// Here we define constants /!\ You need to replace this parameters
define('DEBUG', false);
define('PS_SHOP_PATH', 'shop_path');
define('PS_WS_AUTH_KEY', 'auth_key');
require_once('./PSWebServiceLibrary.php');
//header('Content-Type: text/xml');
try {
// creating web service access
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
// The key-value array
$opt['resource'] = 'customers';
$opt['id'] = $_GET['id'];
// Retrieving the XML data
$xml = $webService->get($opt);
$resources = $xml->customer->children();
foreach ($resources as $key => $resource) {
echo '- '.$key.': '.$resource.'<br />';
}
}
catch (PrestaShopWebserviceException $ex) {
//Show a message related to the error
echo 'Other error: <br />'.$ex->getMessage();
}
?>