Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

PHP accessing .NET thru COM (expert needed)

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

PHP accessing .NET thru COM (expert needed)

Postby reefdvrjim » Fri Mar 15, 2013 8:41 am

Thanks for your help!

I'm using PHP to connect to a SDK (http://developmentzone.pastel.co.za/ind ... le=SDK_PHP) that is only available in .NET. The server is IIS of course. The SDK includes a .dll, .xml and .tlb file.

Here is some of the sample code in the docs...

//Create the COM Helper object
$sdkHelper = new COM("Pastel.Evolution.ComHelper");
prn("Loaded ComHelper, version {$sdkHelper->AssemblyVersion}");
//Initialise
$sdkHelper->CreateCommonDBConnection("uid=sa;pwd=123;Initial Catalog=EvolutionCommon;server=(local)");
prn("Connected to common");
$sdkHelper->SetLicense("DEMO", "67681607597478");
prn("License set");
$sdkHelper->CreateConnection("uid=sa;pwd=123;Initial Catalog=50008;server=(local)");
prn("Connected to database");
if ($sdkHelper->CurrentEvolutionDatabaseVersion != $sdkHelper->CompatibleEvolutionDatabaseVersion)
{
prn("Warning: the current database version is {$sdkHelper->CurrentEvolutionDatabaseVersion} while this version of the SDK is intended for version {$sdkHelper->CompatibleEvolutionDatabaseVersion}");
}

/* This is how you would create a new customer account:
$newAccount = new COM("Pastel.Evolution.Customer");
$newAccount->Code = "PHPTest";
prn("Saving...";
$newAccount->Save();
prn("New account ID: {$newAccount->ID}";
*/
//Initialise an existing account, using it's code
$cashAccount = $sdkHelper->GetARAccount("CASH");
//Create the new sales order object
$salesOrder = new COM("Pastel.Evolution.SalesOrder");
reefdvrjim
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Mar 15, 2013 8:35 am

Re: PHP accessing .NET thru COM (expert needed)

Postby johnj » Fri Mar 15, 2013 7:46 pm

Why don't you create a web service using the dot net and expose the function or method name so that php can access this function or method?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP accessing .NET thru COM (expert needed)

Postby reefdvrjim » Sat Mar 16, 2013 12:09 am

Thanks so much for your advice.

Where is there a good resource on how to do that?

Thanks,
Jim
reefdvrjim
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Mar 15, 2013 8:35 am

Re: PHP accessing .NET thru COM (expert needed)

Postby johnj » Sun Mar 17, 2013 8:26 pm

For creating a dot net web service - Google it.
For consuming a webservice using php, again Google it.
http://phillipnb.wordpress.com/2011/04/ ... es-part-3/
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.