简体   繁体   English

Google Apps脚本无法在cURL中运行吗?

[英]Google Apps Script will not run in cURL?

I can execute this URL (which is a Google Apps Script) from the Browser: 我可以从浏览器中执行以下网址(这是Google Apps脚本):

https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec

My goal is to send a GET to pushingbox that will then send the https: Pushingbox seems to give the same results as cURL. 我的目标是将GET发送到pushbox,然后再发送https:Pushingbox似乎提供与cURL相同的结果。 So for simplification, here is what I get from 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&amp;passive=1209600&amp;continue=https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec&amp;followup=https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec">here</A>.
</BODY>

Why does it appear that when the HTTPS is sent from cURL it requires a login to run the Google Script? 为什么从cURL发送HTTPS时似乎需要登录才能运行Google脚本? I put the Share on the Google Script to "even anonymous can edit" 我在Google脚本上将共享设置为“即使匿名也可以编辑”

Is there a way to get cURL (and hence pushingbox) to work? 有没有一种方法可以使cURL(以及因此pushbox)工作?

Thank you very much for any help. 非常感谢您的帮助。

Adding the -L flag to curl will instruct it to follow the redirect: 将-L标志添加到curl将指示它遵循重定向:

curl -X GET -L https://script.google.com/macros/s/AKfycbyiZfWd10mmuaKPBF4zMMV4WJl_ZmLFrzCJCC_xZmviu-6z4lBS/exec

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM