Jump to content

How Can I lanuch Firefox from within PHP?


Xeoncross

Recommended Posts

 

Well, I wanted to create a COM object from within PHP - but I am having a little trouble. I can launch IE from the COM but I can't launch Firefox or Opera.

 

<?php

//Works
$browser = new COM("InternetExplorer.Application") or die("Unable to start IE");
$browser->Navigate('http://google.com');
$handle = $browser->HWND;
$browser->Quit();

//Does NOT work
$browser = new COM("Firefox.Application") or die("Unable to start FF");
$browser->Navigate('http://google.com');
$browser->Quit();

?>

 

Now, I did research on Mozilla's site and I found a list of CMD line functions you can pass Firefox. So I built this working code:

 

<?php

system('"C:\Program Files\Mozilla Firefox\firefox.exe" http://google.com');

?>

 

However, I want a handle I can use to work with this new FF process - I don't just want to start it. So can anyone help with this?

 

 

http://developer.mozilla.org/en/docs/Command_Line_Options#Windows

http://us.php.net/features.commandline

http://us3.php.net/manual/en/function.system.php

http://kb.mozillazine.org/Command_line_arguments

Neither FF or Opera provide a com interface, so your first option is never going to work.

 

Darn.  :P

 

Well, then it looks like I am stuck with *cringe* IE...

 

 

Oh, and I want to know if I can do things like access parts of the browser from the command line. But I get what you are saying Barand.  ;)

You do realise that accessing anything via COM only accesses COM on the server not the client?

If you want to interact with a clients browser your best option is Javscript because it actually runs on the client.

 

lol, yep I'm not that big of a noob.  ;D

 

This is strictly server-side interaction from PHP to *nix

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.