News:

  • August 21, 2026, 03:43:53 AM

Login with username, password and session length

Author Topic: HTTP Commands  (Read 9504 times)

willpoll

  • Sr. Member
  • ****
  • Posts: 56
HTTP Commands
« 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://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!

willpoll

  • Sr. Member
  • ****
  • Posts: 56
Re: HTTP Commands
« Reply #1 on: October 24, 2017, 02:44:39 PM »
Ah, just found it!!  I needed to drop the "http://HTTP://xxx.xxx.xxx.xxx" portion, so I'm left with:-

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

Yay!!

willpoll

  • Sr. Member
  • ****
  • Posts: 56
Re: HTTP Commands
« Reply #2 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

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: HTTP Commands
« Reply #3 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