alexscheelmeyer/node-phantom — pull request #74 by RaphaelRheault (2013-10-23 18:27:48+00:00)
Title: Added a page.post function

I needed to access a page using the post action for authentication, so I added a page.post function that calls Phantom's open(url,'post',data,callback). I thought I could share it in case someone else needs it.

Definition :
page.post(url, data[, callback])
url : where to post
data : html encoded string with the body of the request
callback : callback function (optional)

Example code :
var phantom=require('node-phantom');
phantom.create(function(error,ph){
ph.createPage(function(err,page){
var data = "email=test@domain.com&pass=my_pass";
page.post('http://domain.com/login',data,function(err,status){
//Do stuff here
});
});
});