Page 1 of 1
How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:11 pm
by mubeena
hai,
In desktop application, using our code we can make open , any application.
Is it possible, in web application?
Regards,
Jasmine
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:21 pm
by requinix
Yes, in most circumstances.
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:23 pm
by Christopher
In the browser then no. On the server you can execute applications if the configurations allow it. You would need to use a plug-in or Java for that.
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:31 pm
by mubeena
Hai,
i want to open a wordpad, using the PHP.
If i tried this code,
<?php
// Some servers may have an auto timeout, so take as long as you want.
set_time_limit(0);
// Show all errors, warnings and notices whilst developing.
error_reporting(E_ALL);
// Used as a placeholder in certain COM functions where no parameter is required.
$empty = new VARIANT();
// Load the appropriate type library.
com_load_typelib('Word.Application');
// Create an object to use.
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
// Open a new document with bookmarks of YourName and YourAge.
$word->Documents->Open('C:/web/Sundance/Delivery Notes/Delivery_Template.doc');
?>
I am getting the error message,
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': Access is denied. ' in D:\DocStation\testing_MIME\11.php:79 Stack trace: #0 D:\DocStation\testing_MIME\11.php(79): com->com('word.applicatio...') #1 {main} thrown in D:\DocStation\testing_MIME\11.php on line 79
Can anyone give me as suggesstion to solve this issue?
Regards,
Jasmine
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:36 pm
by Benjamin
Please use the proper [ code = php ] tags when posting code.
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:43 pm
by mubeena
<?php
print 'test';
set_time_limit(0);
error_reporting(E_ALL);
$empty = new VARIANT();
com_load_typelib('Word.Application');
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
$word->Documents->Open('C:/web/Sundance/Delivery Notes/Delivery_Template.doc');
?>
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 10:49 pm
by Benjamin
Please use the proper [ code = php ] tags when posting code.
You may also want to edit your existing posts so that other users can better read your code.
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 11:05 pm
by mubeena
i didnt understand? What u are expecting?
using my Php code, i want to open a word application.
That is, if i execute, this program, MsWord application, should open automatically.
This is my Php code
<?php
set_time_limit(0);
error_reporting(E_ALL);
$empty = new VARIANT();
com_load_typelib('Word.Application');
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
$word->Documents->Open('C:/web/Sundance/Delivery Notes/Delivery_Template.doc');
?>
This is my another example, to open the Notepad.
<?php
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("notepad.exe", 7, false);
?>
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 11:20 pm
by Benjamin
There is a Code button you press when you want to post your PHP code. You then put your code inside of the tags. Once you have finished, change [ code ] to [ code=php ]. It will then look like this:
Code: Select all
<?php
print 'test';
set_time_limit(0);
error_reporting(E_ALL);
$empty = new VARIANT();
com_load_typelib('Word.Application');
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
$word->Documents->Open('C:/web/Sundance/Delivery Notes/Delivery_Template.doc');
?>
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 11:30 pm
by mubeena
Now i got it.

Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 11:57 pm
by mubeena
hai tasairis,
I just go through, which you gave reference.
i tried one example,
Code: Select all
<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>
I am getting the error message,
Warning: exec() [function.exec]: Unable to fork [whoami]
Re: How to open any application, in web application program?
Posted: Fri Jan 30, 2009 11:58 pm
by Benjamin
Re: How to open any application, in web application program?
Posted: Sat Jan 31, 2009 1:01 am
by mubeena
I did that settings and then restarted my system.
Again, i executed my Program.
It shows, same error message.