IT Community - Software Programming, Web Development and Technical Support

COM functions in php

This is a discussion on COM functions in php within the PHP Programming forums, part of the Web Development category; COM: Component Object Model COM is an acronym for Component Object Model; it is an object orientated layer (and associated ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-03-2008, 10:02 PM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default COM functions in php

COM: Component Object Model

COM is an acronym for Component Object Model; it is an object orientated layer (and associated services) on top of DCE RPC (an open standard) and defines a common calling convention that enables code written in any language to call and interoperate with code written in any other language (provided those languages are COM aware). Not only can the code be written in any language, but it need not even be part of the same executable; the code can be loaded from a DLL, be found in another process running on the same machine, or, with DCOM (Distributed COM), be found in another process on a remote machine, all without your code even needing to know where a component resides.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-03-2008, 10:06 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

Hi,
COM is one of the main ways to glue applications and components together on the Windows platform; using COM you can launch Microsoft Word, fill in a document template and save the result as a Word document and send it to a visitor of your web site. You can also use COM to perform administrative tasks for your network and to configure your IIS; these are just the most common uses; you can do much more with COM.
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-05-2008, 02:32 AM
sureshbabu sureshbabu is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: India
Posts: 101
sureshbabu is on a distinguished road
Send a message via AIM to sureshbabu Send a message via MSN to sureshbabu Send a message via Yahoo to sureshbabu Send a message via Skype™ to sureshbabu
Default Re: COM functions in php

what is the advantages of COM functions?
__________________
Thanks
Regards
Sureshbabu Harikrishnan
+91 9884320017
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-05-2008, 02:33 AM
sureshbabu sureshbabu is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: India
Posts: 101
sureshbabu is on a distinguished road
Send a message via AIM to sureshbabu Send a message via MSN to sureshbabu Send a message via Yahoo to sureshbabu Send a message via Skype™ to sureshbabu
Default Re: COM functions in php

what is the drawback of COM functions?
__________________
Thanks
Regards
Sureshbabu Harikrishnan
+91 9884320017
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-06-2008, 11:24 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

Quote:
Originally Posted by sureshbabu View Post
what is the advantages of COM functions?
Hi,
The COM class allows you to instantiate an OLE compatible COM object and call its methods and access its properties.
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-06-2008, 11:26 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

COM objects abstract a group of functions in software into a redistributable binary component that can interface with a system in ways a scripting language can't interface.
Developed by Microsoft, COM objects are traditionally used in more commonplace Windows-based programming environments such as Visual Basic and Active Server Pages (ASP).
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-06-2008, 11:29 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

Quote:
Originally Posted by sureshbabu View Post
what is the drawback of COM functions?
We can only use these COM object in Windows servers. Generally now a days all are looking for the Linux server with Apache and PHP.

I think this would be the major drawback of COM
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-07-2008, 07:50 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: COM functions in php

Hi

The COM class provides a framework to integrate (D)COM components into your php scripts
PHP Code:
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print 
"Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word->Release();
$word null
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-10-2008, 05:23 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

Installation

There is no installation needed to use these functions; they are part of the PHP core.

The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.

You are responsible for installing support for the various COM objects that you intend to use (such as MS Word); Don't and can't bundle all of those with PHP.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-10-2008, 05:26 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

For Each

Starting with PHP 5, you may use PHP's own foreach statement to iterate over the contents of a standard COM/OLE IEnumVariant. In laymans terms, this means that you can use foreach in places where you would have used For Each in VB/ASP code.

Example: For Each in ASP
Quote:
<%
Set domainObject = GetObject("WinNT://Domain")
For Each obj in domainObject
Response.Write obj.Name & "<br />"
Next
%>
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 04-10-2008, 05:27 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

Example: while() ... Next() in PHP 4
PHP Code:
<?php 
$domainObject 
= new COM("WinNT://Domain"); 
while (
$obj $domainObject->Next()) { 
   echo 
$obj->Name "<br />"

?>
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-10-2008, 05:28 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

Example: foreach in PHP 5
PHP Code:
<?php 
$domainObject 
= new COM("WinNT://Domain"); 
foreach (
$domainObject as $obj) { 
   echo 
$obj->Name "<br />"

?>
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-10-2008, 05:30 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

Exceptions (PHP 5)

This extension will throw instances of the class com_exception whenever there is a potentially fatal error reported by COM. All COM exceptions have a well-defined code property that corresponds to the HRESULT return value from the various COM operations. You may use this code to make programmatic decisions on how to handle the exception.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-11-2008, 06:24 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

Hi,
Thanks for providing these information

Is there COM functions working on Linux server?

if not means is there any other way to use this in PHP using Linux server?
__________________
With,
J. Jeyaseelan

Everything Possible

Last edited by Jeyaseelansarc : 04-11-2008 at 06:28 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 05-02-2008, 05:29 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: COM functions in php

Hi Buddies

phpinfo() has a "com_dotnet" section.

It's kind of odd.

Here it says...

COM Support: enabled
DCOM Support: disabled
.net Support: enabled

What exactly is COM support?
What exactly is DCOM support?
And what exactly is .net support? And why would it say
enabled when .NET is not installed?

DCOM means an ActiveX file gets used. COM pretty much
means the same thing. Those files tend to be based upon
an object model and have a few extra functions there to
help with various programming environments.

ordinal hint RVA name

1 0 000017A6 DllCanUnloadNow
2 1 0000177A DllGetClassObject
3 2 00001790 DllRegisterServer
4 3 00001764 DllUnregisterServer

Other than that COM is not much different than standard
libraries.

And DCOM... that one seems like it might be a COM file put
into a publicly accessible folder, but I'll need some more
help here, if such is available, because something is not
sitting too well here.

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 05-02-2008, 10:21 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: COM functions in php

Hi,
What is the relations between COM and DCOM?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 05-05-2008, 04:54 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

Obviously, DCOM is distributed but COM is not. To be more precise, there are three main elements added to COM:

Quote:
* The way for creating a remote object.
* The way for accessing a remote object.
* The way to ensure secure access to a remote object.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 05-05-2008, 05:15 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

com_get

com_get -- Gets the value of a COM Component's property [deprecated]

Syntax:
mixed com_get ( resource com_object, string property )

Returns the value of the property of the COM component referenced by com_object. Returns FALSE on error.

Example
Quote:
<?php
// do this
$var = $obj->property;
// instead of this:
$var = com_get($obj, 'property');
?>
Note: This function does not exist in PHP 5; instead, you should use the regular and more natural OO syntax to access properties or call methods.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 05-05-2008, 05:18 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

com_propget

com_propget -- Alias of com_get()

Note: This function does not exist in PHP 5; instead, you should use the regular and more natural OO syntax to access properties or call methods.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 05-05-2008, 05:25 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: COM functions in php

com_set

com_set -- Assigns a value to a COM component's property.

Syntax:
void com_set ( resource com_object, string property, mixed value )

Sets the value of the property of the COM component referenced by com_object. Returns the newly set value if succeeded, FALSE on error.

Example:
PHP Code:
<?php 
// do this
$obj->property $value;
// instead of this:
com_set($obj'property'$value);
?>
Note:This function does not exist in PHP 5; instead, you should use the regular and more natural OO syntax to access properties or call methods.
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP FTP Functions Kamalakannan PHP Programming 54 04-14-2008 04:42 AM
Sql functions itbarota Database Support 11 02-29-2008 01:08 AM
What are encryption functions in PHP? Sabari PHP Programming 2 09-17-2007 08:53 AM
What are Virtual Functions? How to implement virtual functions in "C"? Sabari C and C++ Programming 4 09-10-2007 10:35 PM
Imagemagick functions Sivamurugan PHP Programming 4 09-09-2007 10:51 PM