Hello,
assuming that when installin QuickOPC, you have also chosen "COM development", the examples for PHP are under the ExamplesCom folder.
ad 1) Yes. Note that if you are using PHP for a Web app development, it wouldn't make sense to have subscriptions as part of request processing (page generation) code. They must exist on some larger, perhaps global, scope.
ad 2) One of the examples provided is in SubscribeDataChange.Main.php. Here it is:
<?php
// $Header: $
// Copyright [c] CODE Consulting and Development, s.r.o., Plzen. All rights reserved.
//#region Example
// This example shows how to subscribe to changes of a single monitored item and display each change.
class ClientEvents {
function DataChangeNotification($Sender, $E)
{
// Display the data
// Remark: Production code would check e.Exception before accessing e.AttributeData.
printf("%s\n", $E->AttributeData);
}
}
// Instantiate the client object and hook events
$Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");
$ClientEvents = new ClientEvents();
com_event_sink($Client, $ClientEvents, "DEasyUAClientEvents");
printf("Subscribing...\n");
$Client->SubscribeDataChange(
"http://opcua.demo-this.com:51211/UA/SampleServer",
"nsu=http://test.org/UA/Data/;i=10853",
1000);
printf("Processing monitored item changed events for 1 minute...");
$startTime = time(); do { com_message_pump(1000); } while (time() < $startTime + 60);
//#endregion Example
?>
3) Yes. Of course again, our browsing dialogs are for desktop, so that would make no sense at all in a Web app. But the desktop ones work well. An example for it comes in the ShowDialog.Main.php file:
<?php
// $Header: $
// Copyright (c) CODE Consulting and Development, s.r.o., Plzen. All rights reserved.
//#region Example
// This example shows how to let the user browse for an OPC-UA node.
$UAElementType_Host = 1;
$BrowseDialog = new COM("OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseDialog");
$BrowseDialog->InputsOutputs->CurrentNodeDescriptor->EndpointDescriptor->Host = "opcua.demo-this.com";
$BrowseDialog->Mode->AnchorElementType = $UAElementType_Host;
printf("%d\n", $BrowseDialog->ShowDialog);
// Display results
printf("%s\n", $BrowseDialog->Outputs->CurrentNodeElement->NodeElement);
//#endregion Example
?>
Best regards