Announcement

Collapse
No announcement yet.

Javascript HttpRequest POST, License error 2

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Javascript HttpRequest POST, License error 2

    Hi, I'm trying to POST data to myhs service. I don't want to use user & password included in the url so I prefer to use POST form data.

    Both examples give me "License error 2"

    PHP Code:
    function SendRequest()
    {
        var 
    httpRequest = new XMLHttpRequest();
        
    httpRequest.onreadystatechange = function() { HandleReply(httpRequest); };  
      
    httpRequest.open("POST""https://connected2.homeseer.com/JSON?request=getstatus"true);
        
    httpRequest.setRequestHeader('Content-type''application/x-www-form-urlencoded')
        
    httpRequest.send('user=demo@homeseer.com&pass=demo100');

    PHP Code:
    function SendRequest()
    var 
    formData = new FormData();
        
    formData.append("user""demo@homeseer.com");
        
    formData.append("pass""demo100");
        var 
    httpRequest = new XMLHttpRequest();
        
    httpRequest.onreadystatechange = function() { HandleReply(httpRequest); };  
        
    httpRequest.open("POST""https://connected2.homeseer.com/JSON?request=getstatus"true);
        
    httpRequest.setRequestHeader('Content-type''application/x-www-form-urlencoded')
        
    httpRequest.send(formData);

    Please excuse any spelling and grammatical errors I may make.
    --
    Tasker Plugin / Speech Droid
    Tonlof | Sweden

    #2
    Have you seen - http://board.homeseer.com/showthread.php?t=167137 it implies one connection for one user, perhaps you are keeping connections open or something and it believes that there are multiple connections open and as such giving a licencing error?

    Comment


      #3
      Originally posted by mrhappy View Post
      Have you seen - http://board.homeseer.com/showthread.php?t=167137 it implies one connection for one user, perhaps you are keeping connections open or something and it believes that there are multiple connections open and as such giving a licencing error?
      Thank you mrhappy for your input, I don't think it is because of that since it working fine with GET method with the username and password in the url. And I don't think HS demo account above is limited to one connection either but it was a good thought. If there is any info what error 2 is it could help alot to focus on the problem. It could be that the headers is wrong when posting.
      Thanks
      Please excuse any spelling and grammatical errors I may make.
      --
      Tasker Plugin / Speech Droid
      Tonlof | Sweden

      Comment


        #4
        tonlof did you ever found a solution for this ?

        Comment

        Working...
        X