Hello all, I get the following error when hitting submit in my form to post to the spreadsheet:
Fatal error: Uncaught exception 'DOMException' with message 'Namespace Error' in /home/pedrum/public_html/Buzz25/Zend/Gdata/App/Base.php:220 Stack trace: #0 /home/pedrum/public_html/Buzz25/Zend/Gdata/App/Base.php(220): DOMDocument->createElementNS('http://schemas....', 'gsx:') #1 /home/pedrum/public_html/Buzz25/Zend/Gdata/Spreadsheets/Extension/Custom.php(64): Zend_Gdata_App_Base->getDOM(Object(DOMDocument), 1, NULL) #2 /home/pedrum/public_html/Buzz25/Zend/Gdata/Spreadsheets/ListEntry.php(77): Zend_Gdata_Spreadsheets_Extension_Custom->getDOM(Object(DOMDocument)) #3 /home/pedrum/public_html/Buzz25/Zend/Gdata/App/Base.php(329): Zend_Gdata_Spreadsheets_ListEntry->getDOM() #4 /home/pedrum/public_html/Buzz25/Zend/Gdata/Spreadsheets.php(336): Zend_Gdata_App_Base->saveXML() #5 /home/pedrum/public_html/Buzz25/bozzuto.php(51): Zend_Gdata_Spreadsheets->insertRow(Array, '0An0qNAL3GJ0UdH...', 'od6') #6 {main} thrown in /home/pedrum/public_html/Buzz25/Zend/Gdata/App/Base.php on line 220
The following is my code:
require_once 'Zend/Loader.php';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
$email_google = 'persianprez';
$password = 'password';
$authService = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($email_google, $password, $authService);
$spreadsheetService = new Zend_Gdata_Spreadsheets($httpClient);
$key = 'thespreadsheetkey';
$worksheetId = 'od6';
$optout = $_POST['opt'];
$email = urldecode($_POST['email']);
$comments = $_POST['comments'];
$url = "http://spreadsheets.google.com/feeds/list/".$key."/od6/public/values?alt=json";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_USERAGENT,'PrintPCA');
$data = json_decode(curl_exec($ch),true); //dump json into an array
curl_close($ch);
$entries = $data["feed"]["entry"];
?>
</head>
<body>
<?php
if($optout==true or isset($comments)){
echo "<h1>Thanks for your input</h1>";
$optout_insert = array($optout => 'opt-out');
$comments_insert = array($comments => 'comments');
$spreadsheetService->insertRow($optout_insert, $key, $worksheetId);
$spreadsheetService->insertRow($comments_insert, $key, $worksheetId);
}
else{
?>
<form action="file.php" method="post">
<textarea name="comments" cols="100" rows="20"></textarea>
<input name="submit" type="submit" value="submit" />
</form>
<?php
}
?>
</body>
</html>
Thanks in advance!