AppleScript 上的curl
这是我的脚本,但我在从 URL 获取响应时遇到问题。
if newChromeValue contains "http://" then
set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=" & ¬
newChromeValue & ¬
"&title=" & ¬
pgTitlEnc & ¬
"&keywords=" & ¬
mykeywordEnc & ¬
"&description=" & ¬
myDescriptionEnc & ¬
"&type=body&reqtype=main/"
else
set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=http://" & ¬
newChromeValue & ¬
"&title=" & ¬
pgTitlEnc & ¬
"&keywords=" & ¬
mykeywordEnc & ¬
"&description=" & ¬
myDescriptionEnc & ¬
"&type=body&reqtype=main/"
end if
set URLChromeResponse to do shell script URLChromerequest
return URLChromeResponse
当我运行此脚本时,它显示只有第一个参数通过服务器发送,即“body”。其他的似乎丢失了......
但是,如果我返回“URLChromerequest”,我可以看到 URL 是相应的形式,如果我将其粘贴到网络浏览器,它工作正常......
可能是什么问题?
This is my script but I'm having problem on getting the response from the URL.
if newChromeValue contains "http://" then
set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=" & ¬
newChromeValue & ¬
"&title=" & ¬
pgTitlEnc & ¬
"&keywords=" & ¬
mykeywordEnc & ¬
"&description=" & ¬
myDescriptionEnc & ¬
"&type=body&reqtype=main/"
else
set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=http://" & ¬
newChromeValue & ¬
"&title=" & ¬
pgTitlEnc & ¬
"&keywords=" & ¬
mykeywordEnc & ¬
"&description=" & ¬
myDescriptionEnc & ¬
"&type=body&reqtype=main/"
end if
set URLChromeResponse to do shell script URLChromerequest
return URLChromeResponse
When I run this script , it shows that only the first parameter is sent over the server which is 'body'. The others seems to be missing...
however, if I return the 'URLChromerequest' I can see that the URL is form accordingly and if I paste it to the web browser, it works perfectly..
WHat might be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
quoted form
引用 url 可能会有所帮助:虽然不确定,但 url 似乎被 shell 分割了
It might help to quote the url using
quoted form of
:Dont' know for sure though, but it would seem that the url is being split by the shell