Version 1
[yaffs-website] / node_modules / phantomjs-prebuilt / lib / phantom / examples / post.js
diff --git a/node_modules/phantomjs-prebuilt/lib/phantom/examples/post.js b/node_modules/phantomjs-prebuilt/lib/phantom/examples/post.js
new file mode 100644 (file)
index 0000000..4b998b8
--- /dev/null
@@ -0,0 +1,15 @@
+// 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();
+});