mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
16 lines
394 B
JavaScript
16 lines
394 B
JavaScript
|
// Example using HTTP POST operation
|
||
|
|
||
|
"use strict";
|
||
|
var page = require('webpage').create(),
|
||
|
server = 'http://posttestserver.com/post.php?dump',
|
||
|
data = 'universe=expanding&answer=42';
|
||
|
|
||
|
page.open(server, 'post', data, function (status) {
|
||
|
if (status !== 'success') {
|
||
|
console.log('Unable to post!');
|
||
|
} else {
|
||
|
console.log(page.content);
|
||
|
}
|
||
|
phantom.exit();
|
||
|
});
|