diff options
author | Joe Robinson <joe@lc8n.com> | 2015-12-05 17:26:58 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2015-12-05 17:26:58 +0000 |
commit | 9b10210a0df92cdc12284b61ca136d4670482012 (patch) | |
tree | bdd9cf16ddcf6c7e8c73ebe9af9f689cd86fd0ec | |
parent | c2a8c2bef524d18fc6a4ca4f65a02d6dbf3414b0 (diff) |
Do a HTTP request to get all the files
-rw-r--r-- | search.js | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1,9 +1,23 @@ -var http = require('http'); var crypto = require('crypto'); var fs = require('fs'); - +var url = require('url'); var config = JSON.parse(fs.readFileSync('config.json')); +var request = require('request'); +var parsedUrl = url.parse(config.url); var hash = crypto.createHash('sha256').update(config.password).digest('hex'); var cookie = 'password='+hash -console.log(cookie); + +var options = { + url: config.url, + headers: { "Cookie": cookie } +}; + +function result(error, response, body) { + if (!error && response.statusCode == 200) { + var results = JSON.parse(body); + console.log(body); + } +} + +request(options, result); |