This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Set value of object with curl
#1
Hi,

I would like to set an object value from another machine.
I can do this manually from a web browser using this url:


Code:
http://remoteusr:remotepasswd@192.168.0.40:80/scada-remote?m=json&r=grp&fn=write&alias=15/0/87&value=1


When I use curl on the other machine as follows:


Code:
curl -0 -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://remoteusr:remotepasswd@192.168.0.40:80/scada-remote?m=json&fn=write&alias=15/0/87&value=1


the following is returned:

Code:
[1] 6322
[2] 6323
[3] 6324
[4] 6325
[2]   Klaar                   r=grp
[3]-  Klaar                   fn=write
[emm@bilbo 23]$ HTTP/1.1 200 OK
Server: nginx
Date: Mon, 11 Sep 2017 09:56:56 GMT
Content-Type: text/plain
Content-Length: 31
Connection: close

Invalid parameter "r" (request)

The object value is not set.

I'm not particularly familiar with curl and there are a million options to it, so can anyone help me out?
Thanks.
Reply
#2
I've found the solution by using this command:


Code:
curl -0 -i -H "Accept: application/json" -H "Content-Type: application/json" --data "m=json&r=grp&fn=write&alias=15/&value=0"  http://remoteusr:remotepasswd@192.168.0.40:80/scada-remote
Reply
#3
Or just escape the whole url with ""
Reply
#4
(11.09.2017, 13:32)admin Wrote: Or just escape the whole url with ""

That also works indeed!

Thanks.
Reply


Forum Jump: