在尝试将数据发布到谷歌表格时,我得到了
Content-Type application/x-www-form-urlencoded is not a valid input type.
我正在终端上尝试此命令
curl -X POST -d '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:First>first name</gsx:First><gsx:Last>last name</gsx:Last></entry>' https://spreadsheets.google.com/feeds/list/0ArtbScpxn-LHdFQxQzJ3dDN2bEx2REFhYmo3UUxWUWc/od6/public/basic
最佳答案
这是一个老问题,但我想我应该继续提交我的发现。以下curl命令发布到我的测试Google表单。
curl -S -v -X POST --location https://docs.google.com/forms/d/1kqn-xxJeVL4ftczABTIHjonhlf9YUOUlMpsxzFT8Fok/formResponse \
-d entry.1915510022=curl \
-d entry.1382424262=ChriChri \
-d entry.1376741077=chriRoro%40um.com \
-d entry.1604030572=UM
-d entry.561632175=743-555%2B6321 \
-d entry.655897781=Yetassisi \
-d entry.227031813=coment+comanet \
-d entry.345486329=Yes
据我所知,您需要设置 --location、-X POST,并使用 -d 条目添加表单数据。我发现最简单的方法是打开 Chrome 开发工具的“网络”选项卡,然后使用普通表单进行测试提交。然后您可以看到 -d 条目和 URL --location。笔记。我添加了反斜杠和回车符,但在 OSX 上,需要删除这些反斜杠才能在终端中执行命令
关于 curl 将数据发布到谷歌电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8682572/