Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Php

More
19 Jun 2018 16:13 #6458 by support
Replied by support on topic Php
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

Please Log in or Create an account to join the conversation.

More
19 Jun 2018 13:03 #6457 by alr1976
Php was created by alr1976
Hi!

I m testing opclabs with PHP but i Need some tips...
1) It possible use subscribtion in PHP?
2)can i have an example?(subscription with PHP)
3) can i use browser dialogs in PHP?how?
Thanks Alessandro

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.046 seconds