diff options
-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); |