简体   繁体   English

通过curl将shell脚本变量传递给远程PHP文件

[英]Passing shell script variables to remote PHP file via curl

Does anyone know the syntax for this? 有谁知道这个的语法? I have a PHP file that uses argv to turn a parameter into a variable. 我有一个PHP文件,它使用argv将参数转换为变量。

If I use: 如果我使用:

php /path/to/local/phpfile/myphpfile.php variable

that works perfectly, but to a remote PHP file: 这是完美的,但对于远程PHP文件:

php http://remotehost/myphpfile.php variable

I get back: 我回来了:

"could not open input file: http://remotehost/myphpfile.php"

Fine, so I try with curl: 很好,所以我尝试卷曲:

curl --data "variable" http://remotehost/myphpfile.php

But the variable does not get passed. 但变量没有通过。 Is it possible to pass shell script variables to a remote PHP file? 是否可以将shell脚本变量传递给远程PHP文件? Many thanks in advance. 提前谢谢了。

It's HTTP. 这是HTTP。 use GET method, Luke 使用GET方法,Luke

curl http://remotehost/myphpfile.php?data=variable

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

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