(PHP ActiveX) Shopify Delete Product
Delete a product from the shop.
<?php
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Rest')
$rest = new COM("Chilkat.Rest");
$rest->SetAuthBasic('SHOPIFY_PRIVATE_API_KEY','SHOPIFY_PRIVATE_API_SECRET_KEY');
$success = $rest->Connect('chilkat.myshopify.com',443,1,1);
if ($success != 1) {
print $rest->LastErrorText . "\n";
exit;
}
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.StringBuilder')
$sbResponse = new COM("Chilkat.StringBuilder");
$success = $rest->FullRequestNoBodySb('DELETE','/admin/products/#{id}.json',$sbResponse);
if ($success != 1) {
print $rest->LastErrorText . "\n";
exit;
}
if ($rest->ResponseStatusCode != 200) {
print 'Received error response code: ' . $rest->ResponseStatusCode . "\n";
print 'Response body:' . "\n";
print $sbResponse->getAsString() . "\n";
exit;
}
print 'Example Completed.' . "\n";
?>
|