Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: willpoll on October 24, 2017, 02:38:45 PM

Title: HTTP Commands
Post by: willpoll on October 24, 2017, 02:38:45 PM
Hi I'm trying to figure out how to send commands to Axis PTZ cameras from a DoMore PLC.

The camera supports GET/POST messages in the form of:-

  HTTP://xxx.xxx.xxx.xxx/axis-cgi/com/ptz.cgi?gotoserverpresetno=4 to move to preset #4

But how would I send a command like this, obviously the PLC is not a web browser so can it handle HTTP GET/POST messages?

I've tried setting up a TCP client connection, which I have working, but the actual format of the string to STREAMOUT is evading me.

This is more for personal growth than anything else, so don't expend too much effort :)

Thanks!
Title: Re: HTTP Commands
Post by: willpoll on October 24, 2017, 02:44:39 PM
Ah, just found it!!  I needed to drop the "HTTP://xxx.xxx.xxx.xxx" portion, so I'm left with:-

"GET /axis-cgi/com/ptz.cgi?gotoserverpresetno=4$0D$0A"

Yay!!
Title: Re: HTTP Commands
Post by: willpoll on October 24, 2017, 05:20:49 PM
Incidentally, how would one send a space in a HTTP URL?  Percent encoding (%20) does not appear to work in STRPRINT.

-Will
Title: Re: HTTP Commands
Post by: franji1 on October 24, 2017, 09:32:55 PM
Incidentally, how would one send a space in a HTTP URL?  Percent encoding (%20) does not appear to work in STRPRINT.

-Will
It appears that different parts of a URL require different escape sequences.  The address part requires "%20" while the query parameter part requires "+".  See this post from stackoverflow.com: https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20