Salut tout le monde. J'ai un problème. J'ai fait un script en php pour aller lire sur opcserver. Tout fonctionne très bien quand c'est sur le localhost, mais dès que je vien pour mettre un nom de pc ( Node optionnel a la fonction Connect) plus rien ne va. Je sais que l'ordinateur est accessible car je me connect dessus par un autre logiciel de test. Comme je vous ai déjà dit tout fonctionne en localhost. Voici mon code
-----PHP-----
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 $Server; $Server = new COM("OPC.Automation"); $Server->Connect("PhoenixContact.AX-Server.21" , "172.16.158.70"); $Server->OPCGroups->Add( "MyGroup"); $Server->OPCGroups(1)->OpcItems->AddItem( "TestResource.poids_60", 1); $Server->OPCGroups(1)->OpcItems->AddItem( "TestResource.poids_40", 1); $Server->OPCGroups(1)->OpcItems->AddItem( "TestResource.poids_total_silos", 1); $Server->OPCGroups(1)->OpcItems(1)->Read(2); $Server->OPCGroups(1)->OpcItems(2)->Read(2); $Server->OPCGroups(1)->OpcItems(3)->Read(2); echo "Silo 60 : " . round($Server->OPCGroups(1)->OpcItems(1)->value , 2); echo "<br>"; echo "Silo 40 : " . round($Server->OPCGroups(1)->OpcItems(2)->value , 2); echo "<br>"; echo "Total Silo : " . round($Server->OPCGroups(1)->OpcItems(3)->value , 2); -----PHP-----
Comme je l'ai deja dit la fonction connect fonctionne très bien si je retire le "172.16.158.70"...
Si vous avez des suggestion...
Merci
Partager