Skip to content

Instantly share code, notes, and snippets.

@ashizawa
Created April 2, 2014 01:11
Show Gist options
  • Select an option

  • Save ashizawa/9926226 to your computer and use it in GitHub Desktop.

Select an option

Save ashizawa/9926226 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var querystring = require('querystring');
var https = require('https');
var fs = require('fs');
var url = process.argv[2];
var post_data = querystring.stringify({
id : url,
scrape: true
});
var post_options = {
hostname: 'graph.facebook.com',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(post_data)
}
};
console.log("post " + url);
var req = https.request(post_options, function(response){
response.setEncoding('utf8');
response.on('data', function (chunk) {
console.log(chunk);
});
});
console.log("data sending");
req.write(post_data);
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment