When I listen to all the HTTP Request with the Chrome API , how can I get the actual data recieved from it?
I mean if the request is made on a php page (XMLHttpRequest), how can I get the content of this page?
.
I am now quering the data with an ajax request. But this isn't a good solution.
The main problem is when the request uses POST method. The data recieved from the ajax query is not the same as the data recived from the HttpRequest.
Sorry for that you can't get response body via webRequest, and what I do is try a ajax request to request the url for the second time. It's ugly, I have to request the content using background script, but It does work.
var get=function(url,callback){
var xmlRequest=new XMLHttpRequest();
xmlRequest.open('GET',url,true);
xmlRequest.send();
xmlRequest.onreadystatechange=function(){
if(xmlRequest.readyState==4){
callback(xmlRequest.responseText);
}
};
};
you can get the response body from xmlRequest.responseText
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With