Author Topic: need to send via HTTP POST (not HTTP GET)  (Read 4771 times)

jcmarsalis

  • Newbie
  • *
  • Posts: 18
need to send via HTTP POST (not HTTP GET)
« on: January 05, 2024, 08:58:37 pm »
Hi I am working with DTS Autostage to send our now playing data. The want it as a HTTP POST (not HTTP GET). Can I accomplish this in Magic RDS?

Jan

  • Hero Member
  • *****
  • Posts: 1092
Re: need to send via HTTP POST (not HTTP GET)
« Reply #1 on: January 05, 2024, 10:44:47 pm »
Before we implement direct solution, you can POST the text like as showed in following example:

Code: [Select]
saveto file:"d:\post.txt"
cmd "curl -k --data-urlencode varname@d:\post.txt https://server.com/input.php"

Enter such script into the Data Distribution box (Edit Connection - Connection Type: internal channel)

Modify the script:
varname is the variable name accepted by your webserver
d:\post.txt can be changed to any local file name in any existing path
https://server.com/input.php is the URL which accepts the POST request

The text coding is UTF-8 by default.

jcmarsalis

  • Newbie
  • *
  • Posts: 18
Re: need to send via HTTP POST (not HTTP GET)
« Reply #2 on: January 06, 2024, 03:55:37 pm »
Thank you. I've implemented as you described. Will wait to see if they're getting information.

bstapley

  • Newbie
  • *
  • Posts: 2
Re: need to send via HTTP POST (not HTTP GET)
« Reply #3 on: February 02, 2024, 05:39:08 pm »
If I edit the current connection, won't I "break" the current connection to my encoder?  Also, I don't see the Data Distribution box in my current connection.  Current connection is a Kind = RDS Encoder --> Model = Generic UECP.

Before we implement direct solution, you can POST the text like as showed in following example:

Code: [Select]
saveto file:"d:\post.txt"
cmd "curl -k --data-urlencode varname@d:\post.txt https://server.com/input.php"

Enter such script into the Data Distribution box (Edit Connection - Connection Type: internal channel)

Modify the script:
varname is the variable name accepted by your webserver
d:\post.txt can be changed to any local file name in any existing path
https://server.com/input.php is the URL which accepts the POST request

The text coding is UTF-8 by default.

Jan

  • Hero Member
  • *****
  • Posts: 1092
Re: need to send via HTTP POST (not HTTP GET)
« Reply #4 on: February 02, 2024, 06:47:02 pm »
The description above does not apply to your existing connection to the RDS encoder.

Add a new Connection, kind: Bridge, connection type: internal channel. This method is also decribed in the Help: ontheweb.pdf

jcmarsalis

  • Newbie
  • *
  • Posts: 18
Re: need to send via HTTP POST (not HTTP GET)
« Reply #5 on: June 27, 2024, 09:02:20 pm »
Thank you. I've implemented as you described. Will wait to see if they're getting information.

Is there any reason RDS Magic would have trouble with executing a batch file?
Something like

cmd "C:\Users\jcm\Doucuments\send.bat"

Jan

  • Hero Member
  • *****
  • Posts: 1092
Re: need to send via HTTP POST (not HTTP GET)
« Reply #6 on: June 27, 2024, 09:13:54 pm »
cmd "C:\Users\jcm\Documents\send.bat"
in the Internal Channel

or

open "C:\Users\jcm\Documents\send.bat"
in the regular script.

jcmarsalis

  • Newbie
  • *
  • Posts: 18
Re: need to send via HTTP POST (not HTTP GET)
« Reply #7 on: June 27, 2024, 10:13:29 pm »
Thanks!

jcmarsalis

  • Newbie
  • *
  • Posts: 18
Re: need to send via HTTP POST (not HTTP GET)
« Reply #8 on: July 08, 2024, 09:58:21 pm »
I am not convinced the Internal Channel is executing my batch file on data change. My batch file contains a curl command that works fine when executed manually from the command prompt. I had to put the url for the curl command in double quotes for it to work, and RDS Magic wouldn't accept that directly in the Internal Channel, hence the reason for the batch file. I put the following at the end of my batch file to try to get some indication that the script is firing:

echo Logged time = %time% %date%> [full path]\sharklog.txt

but it is not updated unless I run the batch file manually from the command prompt. My instance of RDS Magic is set to Run as Administrator. Log file is not updated when I use the Execute Script tool either.
RDS Magic version 4.0.36 build 2022-01-27

admin

  • Administrator
  • Newbie
  • *****
  • Posts: 10
Re: need to send via HTTP POST (not HTTP GET)
« Reply #9 on: July 09, 2024, 07:09:58 am »
Please use only the most recent version of the Magic RDS. I'm not able to give you any comment to a version which is more that 2 years old.

jcmarsalis

  • Newbie
  • *
  • Posts: 18
Re: need to send via HTTP POST (not HTTP GET)
« Reply #10 on: July 09, 2024, 11:46:06 pm »
Updated all instances to current ver. Seems to be working now... sending and executing batch file. Thanks