卷曲:(6)无法解析主机

时间:2015-07-28 03:49:39

标签: php sh

你好每次我运行我的shell脚本结果“curl:(6)无法解析主机'(temp = 35.4& lux = 7& hum = 23.8)'然后它打印出我的php中的代码执行恢复数据并将其作为文本文件的文件?有谁知道这是什么问题? 在我的shell脚本

while true;
do sleep 2
/home/GPIO/led 1
temp="$(/home/Temp/getTemp)"
lux="$(/home/Light/getLux)"
hum="$(/home/Humid/getHumid)"
/usr/bin/curl "("'temp'=$tmp'&''lux'=$lux'&''hum'=$hum")"             http://192.168.4.3/api.php

在我的api.php中

<?php
    $recivedpostdata=file_get_contents('php://input');
    $datafile = 'data.txt';
    file_put_contents($datafile,$recivedpostdata);
    echo $recivedpostdata;
    ?>

1 个答案:

答案 0 :(得分:0)

尝试curl --data "temp=...&lux=..." http://192.168.4.3/api.php

不确定你想要实现的目标,但如果你想POST temp等等作为参数,这应该做到。看看https://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

相关问题