-
-
Save dscape/1838953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url_parts = url.parse(req.url, true); | |
var query1 = url_parts.query; | |
// Build the post string from an object | |
var query=querystring.stringify(query1); | |
var post_options = { | |
host: 'steamcommunity.com', | |
port: '443', | |
path: '/openid/login?', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'Content-Length': Buffer.byteLength(query) | |
} | |
}; | |
var post_req = http.request(post_options, function(res) { | |
res.setEncoding('utf-8'); | |
var fullBody = ''; | |
res.on('data', function (chunk) { | |
fullBody += chunk.toString(); | |
}); | |
res.on('end', function() { | |
var pattern=/is_valid:true/g; | |
var result = pattern.test(fullBody); | |
// i need the result of this to be | |
} | |
}); | |
}); | |
post_req.write(query); | |
post_req.end(); | |
//HERE | |
res.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request') | |
, qs = require('querystring') | |
; | |
var user = {username: "cl0udy"} | |
, post = | |
{ method: 'POST' | |
, url : 'https://steamcommunity.com/openid/login?' + qs.stringify(user) | |
// , body : qs.stringify(user) | |
} | |
; | |
request(post, function(err,response,body) { | |
console.log(response.statusCode, body); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment