the page that i want to get from my php-script contains ajax. So when i do something like:
file_get_contents($url);
i receive just the contents with javascript.
is it possible to get the page with all ajax executed?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To run javascript contents from javascript coming in through AJAX, you would have to run eval on the script, but you better make absolutely sure the javascript isn’t “user-input”, otherwise using that, you could have some serious security issues on your hands.
It’s also not good practice to use eval – better to load a js file when you pull the contents through AJAX and have your AJAX success activate a function in the js file.