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"
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);
}
Comment