node-phantom icon indicating copy to clipboard operation
node-phantom copied to clipboard

Added a page.post function

Open RaphaelRheault opened this issue 12 years ago • 4 comments

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 protected]&pass=my_pass"; page.post('http://domain.com/login',data,function(err,status){ //Do stuff here }); }); });

RaphaelRheault avatar Oct 23 '13 18:10 RaphaelRheault

I need this badly. :+1:

hallas avatar Nov 15 '13 10:11 hallas

Need this.

michaelklem avatar Jan 20 '14 21:01 michaelklem

ph.createPage(function(err,page){ // why does my application stop here , no error reported . what should I do , thanks

zhouseahe avatar Jun 27 '14 06:06 zhouseahe

++please

starsinmypockets avatar Oct 07 '14 15:10 starsinmypockets