tags:

views:

34

answers:

3

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

+1  A: 

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

Sarfraz
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.
Imran Naqvi
+1  A: 

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.

Sabeen Malik
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.
Imran Naqvi
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.
Imran Naqvi
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.
Sabeen Malik
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.
Sabeen Malik
A: 

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.

Gordon
can we install/use a web browser on webserver ?
Imran Naqvi
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.
Gordon