Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-H16 TCP PHP sample code
#1
I'm using KC868-H16.
How to run tcp send and receive command using php?
Reply
#2
see this guide about PHP tcp socket connection code:
https://www.php.net/manual/en/function.s...onnect.php
Reply
#3
(03-13-2023, 04:35 AM)admin Wrote: see this guide about PHP tcp socket connection code:
https://www.php.net/manual/en/function.s...onnect.php

So it is just a string to send to the server/device?

Sample:  
PHP Code:
$message 'RELAY-SET-255,1,0';
socket_write($socket$messagestrlen($message)); 
Reply
#4
yes, very easy.
$message = 'RELAY-SET-255,1,1'; //turn on relay1
$message = 'RELAY-SET-255,1,0'; //turn off relay1
Reply
#5
(03-13-2023, 06:19 AM)admin Wrote: yes, very easy.
$message = 'RELAY-SET-255,1,1';    //turn on relay1
$message = 'RELAY-SET-255,1,0';    //turn off relay1

Awesome, Thank you.
I have a Smart City and BMS project this year. I will use this product from one of my integration.
Reply
#6
ok, thanks, test with first controller. good luck.
Reply


Forum Jump:


Users browsing this thread: