(PHP Extension) Shopify Delete Product
Delete a product from the shop.
<?php
// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");
$rest = new CkRest();
$rest->SetAuthBasic('SHOPIFY_PRIVATE_API_KEY','SHOPIFY_PRIVATE_API_SECRET_KEY');
$success = $rest->Connect('chilkat.myshopify.com',443,true,true);
if ($success != true) {
print $rest->lastErrorText() . "\n";
exit;
}
$sbResponse = new CkStringBuilder();
$success = $rest->FullRequestNoBodySb('DELETE','/admin/products/#{id}.json',$sbResponse);
if ($success != true) {
print $rest->lastErrorText() . "\n";
exit;
}
if ($rest->get_ResponseStatusCode() != 200) {
print 'Received error response code: ' . $rest->get_ResponseStatusCode() . "\n";
print 'Response body:' . "\n";
print $sbResponse->getAsString() . "\n";
exit;
}
print 'Example Completed.' . "\n";
?>
|