Advertisement
Guest User

Untitled

a guest
Jan 12th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. QML Funtion:
  2. function getVLCstatus()
  3. {
  4. var httpReq = new XMLHttpRequest()
  5. var url = "http://" + ip + ":" + port + "/requests/status.xml";
  6.  
  7. httpReq.open("GET", url, true);
  8.  
  9. // Send the proper header information along with the request
  10. httpReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(username + ":" + password));
  11. httpReq.setRequestHeader('Content-Type', 'text/xml');
  12. httpReq.onreadystatechange = function()
  13. {
  14. if(httpReq.readyState === XMLHttpRequest.DONE)
  15. {
  16. if(httpReq.status == 200)
  17. {
  18. var doc = httpReq.responseXML.documentElement;
  19. for (var ii = 0; ii < doc.childNodes.length; ++ii)
  20. {
  21. console.log(doc.childNodes[ii].nodeName);
  22. console.log(" " + doc.childNodes[ii].nodeValue);
  23. }
  24. }
  25. }
  26. }
  27. httpReq.send();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement