这工作:卷曲--form文件重定向
curl --url http://someurl.tld --form "apikey=39485730"
这不:
curl --url http://someurl.tld --form "apikey=<keyfile"
错误: 无效的API密钥
卷曲手册(http://curl.haxx.se/docs/manpage.html)明确规定
-F/--form (HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. [...] To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.
FWIW: 如果我使用--form“apikey = @ keyfile”,我得到错误:“API密钥是必需的”。 这证实了@肯定是错误的(我很好)。 但为什么<
不工作,怎么办呢?
它看起来就像该文件的内容或者未通过的,还是错。因此,我做了四重确认,只有api键(这里是:39485730),没有其他文件在文件中。
如果它是重要的,为什么我试图做到这一点:
我需要在脚本这个卷曲命令,不想把API密钥那里。相反,它应该在运行此脚本的用户的HOME中,只能由他读取,而不能由其他人读取。
预先感谢您的任何见解... :-)
我相信你的问题将是对堆栈溢出更好。 – alex 2010-01-19 07:09:43