executing an executable file from a web page

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Wed Aug 31, 2005 5:13 am    Post subject: executing an executable file from a web page Reply with quote

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 View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Aug 31, 2005 5:48 am    Post subject: Re: executing an executable file from a web page Reply with quote

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 View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Wed Aug 31, 2005 6:24 am    Post subject: yes Reply with quote

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 View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Aug 31, 2005 6:59 am    Post subject: Re: yes Reply with quote

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 View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Wed Aug 31, 2005 1:49 pm    Post subject: Reply with quote

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 View user's profile Send private message
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Wed Aug 31, 2005 4:41 pm    Post subject: I do appreciate the help....... Awesome Reply with quote

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 View user's profile Send private message
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Wed Aug 31, 2005 4:49 pm    Post subject: Re: I do appreciate the help....... Awesome Reply with quote

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 View user's profile Send private message
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Thu Sep 01, 2005 4:41 pm    Post subject: ok Reply with quote

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 View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Fri Sep 02, 2005 3:22 am    Post subject: Reply with quote

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 View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Fri Sep 02, 2005 4:07 am    Post subject: Reply with quote

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 View user's profile Send private message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Fri Sep 02, 2005 7:50 am    Post subject: Reply with quote

Do you want to run the webcam-program on the users-side or the server-side?
Back to top View user's profile Send private message
Patrick
-


Joined: 02 Dec 2002
Posts: 20
Location: Canada

PostPosted: Sat Sep 03, 2005 2:20 am    Post subject: Reply with quote

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 View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group