I am working on a project which communicates with cash register machines. That machine has own DLLs which were written on DOTNET. I am creating the project on PHP. Those DOTNET DLL's have some methods for communicating. And I am calling them on PHP. First of all I create an object of that class;
$abc = new DOTNET("FirstDotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx", "FirstDotNet.Class1");
Then I call the methods in the same page ;
$abc->ConnectToMachine();
$abc->SignInCashier();
$abc->SendPrintItem();
If I call those in the same page, there is no problem, it prints. But If I call last method on a different page, it gives error, so doesnt print.
I dont want to call first two methods again and again in every page, because those methods take 30 seconds. It is a long time for everytime I want to print.
How can I pass the object that I created in the first page, to another page in order to continue using same object's methods on other pages.
Both pages will need to start a session; page 1 will create the object & store it in the session; page 2 will start the session & retrieve the object. Note I've never used DotNet stuff before, so I've no idea if DotNet objects can be stored in sessions, but I can't find anything that says they can't.
Page 1:
<?php
session_start();
$obj = new DOTNET("FirstDotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx", "FirstDotNet.Class1");
$_SESSION['object'] = $obj;
?>
Page 2:
<?php
session_start();
echo $_SESSION['object']->PrintItem();
?>