PhantomJS gets the response.body of the requested resource

  node.js, question

In usePhantomJSThewebpageModule opens weibo.con page withXMLHttpRequestresource request
,PhantomJSCan I get the return value (response.body) of this resource directly?

You can listen to the events after the “file received”. If the type is ajax, you can call this url with ajax.
Now you don’t need phantomjs to write scripts, you usually use casperjs, but the thinking is the same.
The code can be referred to:

casper.on('resource.received',function(resource){
    if (resource.contentType.indexOf("json") != -1 && resource.stage == "end") {
        var data = casper.evaluate(function(url){
            // synchronous GET request
            return __utils__.sendAJAX(url, "GET");
        }, resource.url);
        console.log(data)
        // do something with data, you might need to JSON.parse(data)
    }
})