Phantomjs不允许我使用jQuery ajax POST
因此,我尝试使用phantomjs获取页面的源代码,然后使用jquery将该源代码发布到php页面进行进一步处理 这是我的第一个PHP页面Phantomjs不允许我使用jQuery ajax POST,jquery,post,phantomjs,Jquery,Post,Phantomjs,因此,我尝试使用phantomjs获取页面的源代码,然后使用jquery将该源代码发布到php页面进行进一步处理 这是我的第一个PHP页面 <?php $output = shell_exec("sudo /usr/local/bin/phantomjs --proxy=127.0.0.1:8118 --web-security=false ./test.js"); ?> 你解决过这个问题吗? var page = require('webpage').create
<?php
$output = shell_exec("sudo /usr/local/bin/phantomjs --proxy=127.0.0.1:8118 --web-security=false ./test.js");
?>
你解决过这个问题吗?
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open("https://github.com/logxen/SmoothieBoard/tree/feature/5driver", function(status) {
if ( status === "success" ) {
page.evaluate(function() {
data = document.body.innerHTML;
console.log(data);
page.injectJs('jquery-1.7.2.min.js');
jQuery.noConflict();
jQuery.ajax({
type:'POST',
async: false ,
url:'post-put-or-get.php',
contentType: 'application/x-www-form-urlencoded',
data:'htmlsource='+data,
success:function(datafeed) {
if(datafeed) {
console.log(datafeed);
} else {
console.log("no joy");
}
}
});
});
phantom.exit();
}
});