我可以从浏览器执行此网址(这是一个Google Apps脚本):
我的目标是向推送箱发送GET,然后发送https:Pushingbox似乎提供与cURL相同的结果。所以为了简化,这是我从cURL得到的:
curl https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec
<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="https://www.google.com/accounts/ServiceLogin? service=wise&passive=1209600&continue=https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec&followup=https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec">here</A>.
</BODY>
为什么当从cURL发送HTTPS时,它需要登录才能运行Google Script?我将Google脚本分享到“甚至匿名可以编辑”
有没有办法让cURL(以及推送盒)工作?
非常感谢您的帮助。
答案 0 :(得分:3)
将-L标志添加到curl将指示它遵循重定向:
curl -X GET -L https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec
希望这有帮助!