[FIXED] HTTP POST

Feature Requests, Comments, Bugs, and Suggestions on the Intelliremote application.

[FIXED] HTTP POST

Postby stbluesrul » Thu Dec 29, 2016 2:40 am

I am trying to send an HTTP POST, however, it doesn't seem to be working. I've looked at a correct HTTP POST and the one sent from Intelliremote using WireShark and I think the issue is the Content-Type. It looks like Intelliremote defaults to text/xml and I need to send application/json instead. Is there a way to set this?
stbluesrul
 
Posts: 116
Joined: Thu Dec 17, 2009 8:53 pm
Location: Las Vegas, NV

Re: HTTP POST

Postby Melloware » Fri Dec 30, 2016 8:16 am

Ahhh I will need to fix this. Intelliremote is so old it was written back when the web only spoke XML and now everyone speaks JSON as well!

https://app.assembla.com/spaces/mellowa ... pe/details
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11055
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: HTTP POST

Postby stbluesrul » Sat Jan 14, 2017 11:06 pm

In the meantime, if anyone else needs to send an HTTP POST with JSON it can be done by calling a VB script with Intelliremote.

HTTP_POST.vbs:
Code: Select all
'URL to open....
sUrl = "http://192.168.1.1:8080/http/post"
'POST Request to send.
sRequest = "{ ""sceneName"": ""Living Room Light On"", ""activate"": 1 }"

HTTPPost sUrl, sRequest

Function HTTPPost(sUrl, sRequest)
  set oHTTP = CreateObject("Microsoft.XMLHTTP")
  oHTTP.open "POST", sUrl,false
  oHTTP.setRequestHeader "Content-Type", "application/json"
  oHTTP.setRequestHeader "Content-Length", Len(sRequest)
  oHTTP.send sRequest
  HTTPPost = oHTTP.responseText
End Function


Code: Select all
CommandLine("C:\Windows\System32\wscript.exe", "C:\scripts\HTTP_POST.vbs")
stbluesrul
 
Posts: 116
Joined: Thu Dec 17, 2009 8:53 pm
Location: Las Vegas, NV

Re: HTTP POST

Postby Melloware » Sun Jan 15, 2017 8:52 am

I plan on fixing this tomorrow in Intelliremote on my day off and sending out a release.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11055
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: [FIXED] HTTP POST

Postby Melloware » Mon Jan 16, 2017 7:51 am

Fixed in 2.8.9 you can now have a 3rd param like...

Code: Select all
;Using HTTP POST to post a small JSON payload
HttpPost("http://localhost:80/example", "{hello: json}", "application/json")
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11055
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA


Return to Intelliremote

Who is online

Users browsing this forum: No registered users and 1 guest

cron