Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. var qs = require("querystring");
  2. var http = require("http");
  3.  
  4. var options = {
  5. "method": "POST",
  6. "hostname": [
  7. "192",
  8. "168",
  9. "0",
  10. "20"
  11. ],
  12. "path": [
  13. "update"
  14. ],
  15. "headers": {
  16. "Content-Type": "application/x-www-form-urlencoded",
  17. "cache-control": "no-cache",
  18. "Postman-Token": "34144980-756e-401b-8f32-088f5ddfa04b"
  19. }
  20. };
  21.  
  22. var req = http.request(options, function (res) {
  23. var chunks = [];
  24.  
  25. res.on("data", function (chunk) {
  26. chunks.push(chunk);
  27. });
  28.  
  29. res.on("end", function () {
  30. var body = Buffer.concat(chunks);
  31. console.log(body.toString());
  32. });
  33. });
  34.  
  35. req.write(qs.stringify({ mode: 'ON',
  36. colorOne: 'new one',
  37. colorTwo: 'new two',
  38. colorThree: 'new three',
  39. colorFour: 'new four',
  40. delayTime: '200',
  41. undefined: undefined }));
  42. req.end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement