Hi mates, my knowledge of HTML is really poor, I need help thanks.
I have a simple static page and I want to send to OBS an object to change the scene, the server expects something like this:
curl -XPOST -H "Content-type: application/json" -d '{"scene-name":"Scene 2"}' 'http://127.0.0.1/emit/SetCurrentScene'
somebody tried help me writing a script but it doesn't work, what is wrong here?
with Wireshark I see the browser sent the command, but it seems the object is missing
E +q@À¨À¨¦FQ&´ô×P²çOPTIONS /emit/SetCurrentScene HTTP/1.1
Host: 192.168.24.2:81
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
Accept: /
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Origin: null
Connection: keep-alive
Server replies::
Eâ+v@À¨À¨Q¦F´ô×P²)HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Allow: POST
Content-Length: 23
Date: Sat, 01 May 2021 09:47:09 GMT
Server: Python/3.8 aiohttp/3.7.4.post0
Thanks for help!
I have a simple static page and I want to send to OBS an object to change the scene, the server expects something like this:
curl -XPOST -H "Content-type: application/json" -d '{"scene-name":"Scene 2"}' 'http://127.0.0.1/emit/SetCurrentScene'
somebody tried help me writing a script but it doesn't work, what is wrong here?
Code:
<body>
<div id="e0" class="cc08">
<a href="#" onclick="setCurrentScene('Scene2')">
<img src="logo.jpg" border="0" alt="Logo" title="Logo">
</a>
</div>
<script>
function setCurrentScene(scenename) {
var url = 'http://192.168.24.2:81/emit/SetCurrentScene';
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}
};
var data = '{"scene-name":"'+scenename+'"}';
xhr.send(data);
}
</script>
with Wireshark I see the browser sent the command, but it seems the object is missing
E +q@À¨À¨¦FQ&´ô×P²çOPTIONS /emit/SetCurrentScene HTTP/1.1
Host: 192.168.24.2:81
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
Accept: /
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Origin: null
Connection: keep-alive
Server replies::
Eâ+v@À¨À¨Q¦F´ô×P²)HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Allow: POST
Content-Length: 23
Date: Sat, 01 May 2021 09:47:09 GMT
Server: Python/3.8 aiohttp/3.7.4.post0
Thanks for help!