I’m writing a PHP-GTK Twitter client, and when I do OAuth authentication, I need to open a browser to show the user the out-of-band token. I also need to have a dialog box open and operational during this time for the user to enter in that token.
The problem is, on Linux, when I open the browser with xdg-open URL, PHP seems to pause until I close the browser window. I need PHP to launch the browser, then open the dialog. Can I make PHP just execute the command and continue on with the script?
On *nix, you can launch an external program and continue (i.e. not block) using the
&operator. You also have to redirect STDOUT and STDERR to somewhere in order for this to work correctly.So you would do something like this:
There is also a way to do it on Windows, which I will add when I find it.
EDIT
You can achieve the same thing of Windows using the following snippet:
The
FALSEargument passed in the second line is the part that stops it from blocking.