◆ __construct()
PrestaShopWebservice::__construct |
( |
|
$url, |
|
|
|
$key, |
|
|
|
$debug = true |
|
) |
| |
◆ add()
PrestaShopWebservice::add |
( |
|
$options | ) |
|
Add (POST) a resource.
Unique parameter must take :
'resource' => Resource name
'postXml' => Full XML string to add resource<br>
Examples are given in the tutorial
- Parameters
-
- Returns
- SimpleXMLElement|boolean status_code, response
- Exceptions
-
Definition at line 262 of file PSWebServiceLibrary.class.php.
◆ checkStatusCode()
PrestaShopWebservice::checkStatusCode |
( |
|
$status_code | ) |
|
|
protected |
Take the status code and throw an exception if the server didn't return 200 or 201 code.
- Parameters
-
int | $status_code | Status code of an HTTP return |
- Returns
- void
Definition at line 89 of file PSWebServiceLibrary.class.php.
◆ edit()
PrestaShopWebservice::edit |
( |
|
$options | ) |
|
Edit (PUT) a resource.
Unique parameter must take :
'resource' => Resource name ,
'id' => ID of a resource you want to edit,
'putXml' => Modified XML string of a resource<br>
Examples are given in the tutorial
- Parameters
-
array | $options | Array representing resource to edit. |
- Returns
- SimpleXMLElement|boolean status_code, response
- Exceptions
-
Definition at line 398 of file PSWebServiceLibrary.class.php.
◆ executeRequest()
PrestaShopWebservice::executeRequest |
( |
|
$url, |
|
|
|
$curl_params = array() |
|
) |
| |
Handles a CURL request to PrestaShop Webservice.
Can throw exception.
- Parameters
-
string | $url | Resource name |
mixed | $curl_params | CURL parameters (sent to curl_set_opt) |
- Returns
- array status_code, response
Definition at line 120 of file PSWebServiceLibrary.class.php.
References dol_syslog().
◆ get()
PrestaShopWebservice::get |
( |
|
$options | ) |
|
Retrieve (GET) a resource.
Unique parameter must take :
'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)
OR
'resource' => Resource name,
'id' => ID of a resource you want to get<br>
<?php require_once './PrestaShopWebservice.php'; try { $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false); $xml = $ws->get(array('resource' => 'orders', 'id' => 1)); // Here in $xml, a SimpleXMLElement object you can parse foreach ($xml->children()->children() as $attName => $attValue) echo $attName.' = '.$attValue.'
'; } catch (PrestaShopWebserviceException $ex) { echo 'Error : '.$ex->getMessage(); } ?>
- Parameters
-
array | $options | Array representing resource to get. |
- Returns
- SimpleXMLElement|boolean status_code, response
- Exceptions
-
Definition at line 315 of file PSWebServiceLibrary.class.php.
◆ getVersion()
PrestaShopWebservice::getVersion |
( |
| ) |
|
◆ head()
PrestaShopWebservice::head |
( |
|
$options | ) |
|
Head method (HEAD) a resource.
- Parameters
-
array | $options | Array representing resource for head request. |
- Returns
- SimpleXMLElement status_code, response
- Exceptions
-
Definition at line 356 of file PSWebServiceLibrary.class.php.
◆ parseXML()
PrestaShopWebservice::parseXML |
( |
|
$response | ) |
|
|
protected |
Load XML from string.
Can throw exception
- Parameters
-
string | $response | String from a CURL response |
- Returns
- SimpleXMLElement|boolean status_code, response
- Exceptions
-
Definition at line 230 of file PSWebServiceLibrary.class.php.
◆ printDebug()
PrestaShopWebservice::printDebug |
( |
|
$title, |
|
|
|
$content |
|
) |
| |
The documentation for this class was generated from the following file: