I have used file_get_contents
function to get content of a website. However it doesn't load the content that displayed in an Ajax.
How can I get fully content after the ajax complete?
echo file_get_contents("thewebsiteurl");
I mean in the thewebsiteurl
has an Ajax, and content ABC displayed after this ajax. When I use file_get_contents
to get the content of the thewebsiteurl
, I can not get the ABC content.
Thanks
CodePudding user response:
It is not clear what you mean.
What I do get out of it is that you're trying to send data with Ajax. This data then needs to get processed in PHP.
Ajax automatically encode the data with JSON for you. This means that in you php code you should use
json_decode();
I hope this was the answer to your vague question.
CodePudding user response:
If you are looking for content from different domain this will do the trick:
$.ajax({
url:'http://www.corsproxy.com/'
'en.wikipedia.org/wiki/Briarcliff_Manor,_New_York',
type:'GET',
success: function(data){
$('#content').html($(data).find('#firstHeading').html());
}
});
Thanks