0

is there any extension in php using which we load a browser instance like we do in desktop application cations.

3 Answers 3

1

If you are looking for ways to go to a website and act like a valid user from PHP, then you are probably looking for cURL http://php.net/manual/en/book.curl.php

Otherwise you need to understand that PHP runs on the server and renders HTML, which is sent to the clients browser, so it can not directly control anything that happens on the client side.

Sign up to request clarification or add additional context in comments.

4 Comments

yes, you got me right. i need to use a browser instance loaded in memory and want to control that instance using some php library.
and we know curl cannot help because i need to populate DOM structure in memory and want to execute javascript too. i need control over a living and breathing browser.
You can not call cURL a browser instance per se but it can make it easy for you to make GET/POST requests and maintain sessions/cookies with a website, hence a PHP script can easily pretend to be a valid user, however as rendering the HTML page including javascript is a full-blown browser specific task, cURL can not do that for you, it will just make it easy for you to get the HTML from the server and how you manipulate it, is upto you.
PHP can not control other executables in the OS directly, all it can do is send out exec() command, what that program does after that is outside the control of PHP. The browser is an independent program and unless you decide to write your own browser, it would/should not give you access/control over what it has in memory.
1

Nope, that's not possible; it is up to user/visitor to open and close browser instances.

1 Comment

No bro there should be a way, if web server is running on a OS then a browser can too, and if php can control other executables in OS why cant it control browser in memory. There should be a php extension or we can make one.
0

PHP is server side, it can't do anything to control what the client is doing other than basic things like redirecting or setting headers.

2 Comments

can we install/use a web browser on webserver ?
You can of course run a web browser on the same machine as the web server, but that doesn't do anything to break down the distinction between the server and the client. They're merely running on the same machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.