I need to click a button in a remote page loaded using loadHTMLFile, like in javascript.
It is possible? Something like:
$domObject->getElementById('clickableButton')->click();
Thanks!
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.
When you have loaded the page in the DOM, it’s just a bunch of strings divided in objects. So answer is no – DOM in PHP can’t parse and run javascript code.
However, if you’re trying to submit a form, you can make GET/POST request to the URL given in action attribute of the form element. Try using cURL, or just
file_get_contentsmay do the trick.