2 Replies Latest reply on Apr 15, 2019 8:41 AM by ggarenne

    PISDK with COM php.




      i'm working on a project and i have to call PISDK in php.


      I want to set a value in a PiPoint but when i set it i have an error 'Parameter 0: type mismatch'


      Here is my code:


      $this->comObjPi = new COM('PISDK.PISDK');


      $this->PIserver = $this->comObjPi->Servers->Item($conf['server']);



      $this->PIpoint = $this->PIserver->PIPoints($tag);

      $PIvalues = new COM('PISDK.PIValues');

      $PIvalue = new COM('PISDK.PIValue');




          $time = $this->PIserver->ServerTime->Clone();


          $PIvalue->TimeStamp = $time;

          $PIvalue->Value = new Variant($value, VT_R8);

          $this->PIpoint->Data->UpdateValue($PIvalue, $time);


      catch(Exception $e)  { var_dump($e); }



      Can you help me ?


      Ok so i found that UpdateValue function need VT_VARIANT type params to be passed.

      When i try to create a new variant with VT_VARIANT type, i get 'Variant type conversion failed'


      function UpdateValue( /* VT_VARIANT [12] [in] */ $newValue, /* VT_VARIANT [12] [in] */ $TimeStamp, /* ? [29] [in] */ $MergeType, /* VT_PTR [26] [in] --> ? [29] */ &$asynchStatus ) { /* Send a single value (snapshot or archive) to PI */ }




      Ce message a été modifié par : GEOFFREY GARENNE

        • Re: PISDK with COM php.

          Hello Geoffrey,


          PI SDK is announced for deprecation and we strongly discourage starting new development efforts against PI SDK.

          You might be interested in earlier discussions on the subject and I believe this one is a pretty good starting point but you also could search the forums for the keyword PHP.

          PHP is not a common programming language in the PI World which means you will not find much examples. Maybe it makes sense to take a step backwards. Can you indicate what your project is about?

          If it has to be PHP, I suggest you to look at Developing a PHP application using PI Web API.


          Please allow me to move your question to a sub space inside PI Developers Club ´for improved visibility.

            • Re: PISDK with COM php.

              Hello Gregor,


              Yes i know, but my client don't want to buy PIWebAPI. So i have to find a solution for sending datas to PI Server with PHP.

              The only problem is to convert the PIValue to a variant with VT_VARIANT type.


              I found no solution on internet to convert datas to a VT_VARIANT type variant on PHP.