프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$debug | is debug activated | ||
$key | Authentification key | ||
$url | Shop URL | ||
$version | PS version |
메소드 | 설명 | |
---|---|---|
__construct ( string $url, string $key, mixed $debug = true ) |
PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
getMessage();
}
?>
|
|
add ( array $options ) : SimpleXMLElement |
Add (POST) a resource
Unique parameter must take : |
|
delete ( array $options ) | Delete (DELETE) a resource. | |
edit ( array $options ) |
Edit (PUT) a resource
Unique parameter must take : |
|
get ( array $options ) : SimpleXMLElement |
Retrieve (GET) a resource
Unique parameter must take :
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.' |
|
getVersion ( ) | ||
head ( array $options ) : SimpleXMLElement | Head method (HEAD) a resource | |
printDebug ( $title, $content ) |
메소드 | 설명 | |
---|---|---|
checkStatusCode ( integer $status_code ) | Take the status code and throw an exception if the server didn't return 200 or 201 code | |
executeRequest ( string $url, mixed $curl_params = [] ) : array | Handles a CURL request to PrestaShop Webservice. Can throw exception. | |
parseXML ( string $response ) : SimpleXMLElement | Load XML from string. Can throw exception |
getMessage();
}
?>
Unique parameter must take :
'resource' => Resource name
'postXml' => Full XML string to add resource
Examples are given in the tutorial
protected checkStatusCode ( integer $status_code ) | ||
$status_code | integer | Status code of an HTTP return |
delete(array('resource' => 'orders', 'id' => 1));
Following code will not be executed if an exception is thrown.
echo 'Successfully deleted.';
}
catch (PrestaShopWebserviceException $ex)
{
echo 'Error : '.$ex->getMessage();
}
?>
Unique parameter must take :
'resource' => Resource name ,
'id' => ID of a resource you want to edit,
'putXml' => Modified XML string of a resource
Examples are given in the tutorial
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
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();
}
?>