在电子表格中插入行时 PHP Zend Gdata 错误 400
我正在做一个小类来加载电子表格并在其中插入数据,但是当我插入一行时我检索到错误:
预期响应代码 200,收到 400 抱歉,服务器错误 发生。请稍等一下,然后尝试重新加载您的电子表格。
我在这个网站和谷歌上查看过,有些人在尝试插入大写字母或空格的数据时遇到了这个错误...我不想插入这样的数据,所以我想这不是我的错误。我的代码给我带来了问题:
try {
echo $this->_spreadId . '<br>';
echo $this->_defaultWorksheetId . '<br>';
echo get_class($this->_spreadClient) . '<br>';
$rowData = array('stuff' => 'smurf');
$this->_spreadClient->insertRow($rowData, $this->_spreadId, $this->_defaultWorksheetId);
} catch (Exception $exc) {
echo '<br><pre>' . $exc->getTraceAsString() . '</pre>';
echo '<br>' . $exc->getMessage();
}
该脚本的输出是:
tVe4Mr82qD3LRhubQrcLxMQ
od6
Zend_Gdata_Spreadsheets
#0 /home/sergi/projects/quiniela2gdocs/lib/Zend/Gdata.php(219): Zend_Gdata_App->performHttpRequest('POST', 'https://spreads...', Array, 'performHttpRequest('POST', 'https://spreads...', Array, 'post('insertEntry('insertRow(Array, 'tVe4Mr82qD3LRhu...', 'od6')
Expected response code 200, got 400 We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.
此类的另一种方法是创建电子表格,并且运行良好,因此我认为与 gDocs 不存在连接问题。
欢迎提供一些帮助。
非常感谢!
I'm doing an small class to load spreadsheets and insert data in them but when I insert a row i retrieve an error:
Expected response code 200, got 400 We're sorry, a server error
occurred. Please wait a bit and try reloading your spreadsheet.
I have looking in this site and google and some people has this error when they trying to insert data with capital letters or spaces... i'm not trying to insert data like this so i suppose that this is not my error. I the code that is giving me problems:
try {
echo $this->_spreadId . '<br>';
echo $this->_defaultWorksheetId . '<br>';
echo get_class($this->_spreadClient) . '<br>';
$rowData = array('stuff' => 'smurf');
$this->_spreadClient->insertRow($rowData, $this->_spreadId, $this->_defaultWorksheetId);
} catch (Exception $exc) {
echo '<br><pre>' . $exc->getTraceAsString() . '</pre>';
echo '<br>' . $exc->getMessage();
}
The output of this script is:
tVe4Mr82qD3LRhubQrcLxMQ
od6
Zend_Gdata_Spreadsheets
#0 /home/sergi/projects/quiniela2gdocs/lib/Zend/Gdata.php(219): Zend_Gdata_App->performHttpRequest('POST', 'https://spreads...', Array, 'performHttpRequest('POST', 'https://spreads...', Array, 'post('insertEntry('insertRow(Array, 'tVe4Mr82qD3LRhu...', 'od6')
Expected response code 200, got 400 We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.
Another method of this class is creating the spreadsheet and it's doing well, so i think there aren't connecting issues with gDocs.
Some help is welcome.
Lots of thanks !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于数组中存在空格,我遇到了类似的问题。删除空格帮助我:
I had a similar problem which has arisen due to the presence of spaces in the array. Remove spaces helped me: