简体   繁体   English

如何响应从PHP文件到bash脚本?

[英]how to response from php file to bash script?

I created a website on centos 6. I posted a request to the website (it has a php file) from a bash script with this command: 我在centos 6上创建了一个网站。我使用以下命令从bash脚本向该网站发布了一个请求(该网站有一个php文件):

curl -X POST -d text="example" "website"

However, I can not return a response from the php file to the bash script. 但是,我无法将响应从php文件返回到bash脚本。 How can I do this? 我怎样才能做到这一点?

You are making a HTTP POST request with CURL but you haven't told it to return anything. 您正在使用CURL发出HTTP POST请求,但尚未告诉它返回任何内容。

Try this: 尝试这个:

curl -v -X POST -d text="example" "website"

This is telling the CURL to verbosely dump everything about the response (header and body). 这是在告诉CURL详细地转储有关响应的所有信息(标头和正文)。

Here's the documentation for command line usage: http://curl.haxx.se/docs/manpage.html 这是命令行用法的文档: http : //curl.haxx.se/docs/manpage.html

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

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