View previous topic :: View next topic |
Author |
Message |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Wed Aug 31, 2005 5:13 am Post subject: executing an executable file from a web page |
|
|
I would like to be able to have someone
hit my web page and click on the link "start my cam"
I have a short cut ****.exe in my htdocs that is targeting
the executable program in my program files
is this possible??
thanks
Patrick |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Wed Aug 31, 2005 5:48 am Post subject: Re: executing an executable file from a web page |
|
|
Patrick wrote: | I would like to be able to have someone
hit my web page and click on the link "start my cam"
I have a short cut ****.exe in my htdocs that is targeting
the executable program in my program files
is this possible??
thanks
Patrick |
You'd need to use a scripting language.
As the only language im any good in is PHP, http://uk.php.net/manual/en/function.exec.php would do what you want.
Im sure someone would be willing to post an example, if you need it. _________________
 |
|
Back to top |
 |
 |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Wed Aug 31, 2005 6:24 am Post subject: yes |
|
|
using php would be great
if it could even start the web cam program when someone enters the page
do you have an example of this?? |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Wed Aug 31, 2005 6:59 am Post subject: Re: yes |
|
|
Patrick wrote: | using php would be great
if it could even start the web cam program when someone enters the page
do you have an example of this?? |
There are 2 ways off of the top of my head. (There are many more however.)
Code: | $output = exec("C:\\directory\\webcam.exe"); |
Or
Code: | $output = `C:\\directory\\webcam.exe`; |
Im not sure if backtick operators (The second example.) are suppored in < PHP5, but it would be the easiest option. (And note the double slashes.) _________________
 |
|
Back to top |
 |
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Wed Aug 31, 2005 1:49 pm Post subject: |
|
|
You can also close the webcam-program with this code, assuming you're using windows:
Code: |
<?
exec("taskkill /F /IM webcam.exe"); //Note: if the executable is called something else than webcam.exe, just change it.
?> |
|
|
Back to top |
|
 |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Wed Aug 31, 2005 4:41 pm Post subject: I do appreciate the help....... Awesome |
|
|
however so far... no luck
first i should start off with what i am operating
Abyss Web Server version X1
PHP , version 3.0
Windows xp home
I gess if i was granted it all ....
I would ask for something like this
Code: | <A HREF="*.exe" onclick="return execute ('*.exe');">Turn on cam</A> |
but given my above operating info... a php script would be fantastic also _________________ Patrick |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Wed Aug 31, 2005 4:49 pm Post subject: Re: I do appreciate the help....... Awesome |
|
|
Patrick wrote: | however so far... no luck
first i should start off with what i am operating
Abyss Web Server version X1
PHP , version 3.0
Windows xp home
I gess if i was granted it all ....
I would ask for something like this
Code: | <A HREF="*.exe" onclick="return execute ('*.exe');">Turn on cam</A> |
but given my above operating info... a php script would be fantastic also |
If it was valid, your example code would try and execute a file on the users machine, not your server. You should upgrade your PHP to V4 or V5 and try the examples given above if you want a user to load a page and cause a file to run on your server. _________________
"Invent an idiot proof webserver and they'll invent a better idiot..." |
|
Back to top |
|
 |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Thu Sep 01, 2005 4:41 pm Post subject: ok |
|
|
I have completed the upgrade to v5
and made 2 separate files .
test1.php
Code: |
<?php
$output = exec("C:\\directory\\directory\\webcam.exe");
?> |
test2.php
Code: |
<?php
$output = `C:\\directory\\directory\\webcam.exe`;
?> |
I brought up both files in the browser and still no success....Am I doing something wrong??
[/code] _________________ Patrick |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Fri Sep 02, 2005 3:22 am Post subject: |
|
|
Not sure if it was deliberete, but, is the webcam program actually located at "C:\\directory\\directory\\webcam.exe"?
That was something you'll need to change, if not. (E.G. "C:\\Program Files\\mIRC\\mirc.exe" for mIRC.) _________________
 |
|
Back to top |
 |
 |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Fri Sep 02, 2005 4:07 am Post subject: |
|
|
the directory\\directory was deliberete
I have the right path in the php files I created......
been googling all day....about this _________________ Patrick |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Fri Sep 02, 2005 7:50 am Post subject: |
|
|
Do you want to run the webcam-program on the users-side or the server-side? |
|
Back to top |
|
 |
Patrick -
Joined: 02 Dec 2002 Posts: 20 Location: Canada
|
Posted: Sat Sep 03, 2005 2:20 am Post subject: |
|
|
I would like the user to be able to start my web cam program
so that it activates on my computer ....when this starts my cam it results in a live feed on my web page...I have everything set up just want that capability...
thanks for your concern and sorry about the delayed response _________________ Patrick |
|
Back to top |
|
 |
|