這工作:捲曲--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