require_once 'GShoppingContent.php';
// Get the user credentials
$creds = Credentials::get();
// Create a client for our merchant and log in
$client = new GSC_Client($creds["merchantId"]);
$client->login($creds["email"], $creds["password"]);
// Now enter some product data
$product = new GSC_Product();
$product->setSKU("dd192");
$product->setProductLink("http://code.google.com/");
$product->setTitle("Dijji Digital Camera");
$product->setPrice("199.99", "usd");
$product->setAdult("false");
$product->setCondition("new");
$product->setBatchOperation("insert");
$batch = new GSC_ProductList();
$batch->addEntry($product);
// Finally send the data to the API
$feed = $client->batch($batch);
$products = $feed->getProducts();
$operation = $products[0];
echo 'Inserted: ' . $operation->getTitle() . "\n";
echo 'Status: ' . $operation->getBatchStatus() . "\n";
/**
 * Credentials - Enter your own values
 *
 * @author afshar@google.com
**/
class Credentials
{
    public static function get()
 /**
  * Create a feed object with a specified batch operation on each element.
  *
  * @param array $entries The list of entries to add in batch.
  * @param string $operation The batch operation desired.
  * @return GSC_ProductList|GSC_InventoryEntryList The constructed batch feed.
  **/
 public function _createBatchFeed($entries, $operation, $feedType = 'product')
 {
     if ($feedType == 'inventory') {
         $entriesBatch = new GSC_InventoryEntryList();
     } else {
         // fallback for all unknown as well as 'product'
         $entriesBatch = new GSC_ProductList();
     }
     foreach ($entries as $entry) {
         $entry->setBatchOperation($operation);
         $entriesBatch->addEntry($entry);
     }
     return $entriesBatch;
 }
$client = new GSC_Client($creds["merchantId"]);
$client->login($creds["email"], $creds["password"]);
// Insert a product so we can delete it
$id = "SKU124";
$country = "US";
$language = "en";
$product = buildMockProduct($id, $country, $language);
$product = $client->insertProduct($product);
echo 'Inserted: ' . $product->getTitle() . "\n";
// Create a dummy <atom:entry> element to include as a batch delete
$dummyDeleteEntry = new GSC_Product();
$dummyDeleteEntry->setBatchOperation("delete");
// set the atom id element as specified by the batch protocol
$editLink = $client->getProductUri($id, $country, $language);
$dummyDeleteEntry->setAtomId($editLink);
$batch = new GSC_ProductList();
$batch->addEntry($dummyDeleteEntry);
// Finally send the data to the API
$feed = $client->batch($batch);
$products = $feed->getProducts();
$operation = $products[0];
echo 'Deleted: ' . $operation->getTitle() . "\n";
echo 'Status: ' . $operation->getBatchStatus() . "\n";
/**
 * Credentials - Enter your own values
 *
 * @author afshar@google.com
**/
class Credentials
{
    public static function get()