We help IT Professionals succeed at work.

With PHP basic auth to webpage and then with php emulate click on link on that page

netslt asked

I can not solve this - looking for ways to have a php function that does this:

- Basic Auth to a webpage
- "Click" an element on that webpage to trigger a jQuery action that is tied to this button
- or trigger that jQuery function directly

Any ideas?

Watch Question

Fixer of Problems
Most Valuable Expert 2014
I don't think that will ever work.  PHP is not a browser and does not run Javascript or Jquery.
David FavorFractional CTO
Distinguished Expert 2019
I agree with Dave. As your question is stated, you're taking Javascript vs. PHP... two different beasts...

Normally the way this is accomplished is via AJAX. Maybe that's what you're asking.

You PHP serves content, including Javascript which executes + does callbacks to server to instantiate a session.

If you're new to this type of logic/coding, load up a copy of WordPress + decode how they handle this + also look at admin-ajax.php which provides the plumbing for continual round trips between browser <-> server, to transmit browser data + then change browser data based on returned server data.
Most Valuable Expert 2017
Distinguished Expert 2019

Why do you want to do this?