/** * Deletes all recipes by performing an HTTP POST to the * batch URI. * @return Zend_Http_Response The reponse of the post */ function batchDelete() { $client = Zend_Gdata_AuthSub::getHttpClient($_POST['token']); $gdata = new Zend_Gdata_Gbase($client); $response = $gdata->post(buildBatchXML(), ITEMS_FEED_URI . '/batch'); return $response; }
/** * Deletes all recipes by performing an HTTP POST to the * batch URI. */ function batchDelete() { $ch = curl_init(); /* Create a CURL handle. */ global $developerKey, $itemsFeedURL; /* Set cURL options. */ curl_setopt($ch, CURLOPT_URL, $itemsFeedURL . "/batch"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: AuthSub token="' . $_POST['token'] . '"', 'X-Google-Key: key=' . $developerKey, 'Content-Type: application/atom+xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, buildBatchXML()); $result = curl_exec($ch); /* Execute the HTTP request. */ curl_close($ch); /* Close the cURL handle. */ return $result; }