hi there.. im having this python scripts snippet:
import webbrowser
url = 'http://idiotinside.com'
# Open URL in new browser window
webbrowser.open_new(url) # opens in default browser
# Opens in mozila browser
webbrowser.get('firefox').open_new_tab(url)
and PHP code to execute the python:
exec('C:\Python27\python.exe C:\xampp\htdocs\wd\launch_ff.py');
but it seems firefox is not launched.
Need help!!
PHP run python code
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: PHP run python code
Where do you expect it to launch Firefox? PHP runs on the server, so it will open a process and run Firefox there and then terminate the process.
(#10850)
Re: PHP run python code
i want to launch Firefox in my local after execute the script. is that possible?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: PHP run python code
You can run Firefox on the server, but it is run by the web server process. And Firefox should exit when the script exits. What is it you are trying to do?
You want to launch Firefox from a web page? How about:
<a href="mypage.php" target="_blank">Open Firefox</a>
You want to launch Firefox from a web page? How about:
<a href="mypage.php" target="_blank">Open Firefox</a>
(#10850)
Re: PHP run python code
Here is what my code is working:
1. launch firefox with urls taken from database..there will be multiple windows of firefox browser once the code is executed.
2. Firefox will exit once all url are loaded.
The objective of launching url into browser is for firebug add-on in the browser to analyse the url page.
1. launch firefox with urls taken from database..there will be multiple windows of firefox browser once the code is executed.
2. Firefox will exit once all url are loaded.
The objective of launching url into browser is for firebug add-on in the browser to analyse the url page.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US