1
A
回答
0
請檢查:https://github.com/Dzduino/DFRobot-RLY-8-Web-Control/blob/master/index.php
您可以使用PHP的Socket像波紋管在HTML或PHP頁面,請注意,您必須使用一些本地PHP服務器(例如:XAMPP)來測試它:
<?php
$addr = "192.168.1.10"; // RLY-8 Default Adress
$port = 2000; // RLY-8 Default port
$timeout = 30; // Connection Time out in Sec
if (isset($_POST["cmd"])){ // check if a submit was done, otherwise the communicatino will start after page loading
$cmd = $_POST["cmd"] ; // Capture the input Command
$fp = fsockopen ($addr, $port, $errno, $errstr, $timeout); // initiate a socket connection
if (!$fp) {
echo "($errno) $errstr\n"; // return the error if no connection was established
} else {
fwrite ($fp, $cmd); // Send the command to the connected device
echo fread($fp, 128); // Echo the return string from the device
fclose ($fp); // close the connection
}
}
?>
0
相關問題
- 1. Perl的POE DirWatcher
- 2. POE :: Component :: Server :: NRPE,返回值
- 3. 瞭解POE-Tk中的名稱空間
- 4. @INC中找不到POE/Component/Client/HTTP.pm
- 5. 傳遞繼承的對象使用JSON
- 6. 如何使用Perl的POE識別Windows PnP事件?
- 7. 如何降低POE-Tk的使用破壞?
- 8. 是否允許同時使用多個Perl POE提供程序?
- 9. 綁定中繼器使用JSON文件中的字符串
- 10. Playframework JSON繼承
- 11. 使用PHP中繼()
- 12. 如何在Spring Controller中使用JSON發送繼承的對象?
- 13. PERL POE ReadWrite Wheel文件IO示例?
- 14. 如何針對POE EasyDBI編寫測試?
- 15. C#json DeserializeObject繼承
- 16. 如何在Perl中使用POE :: Component :: IRC :: State來檢查用戶是否使用NickServ進行身份驗證?
- 17. 在Python中使用繼承
- 18. 在meteor.js中使用繼承
- 19. 使用本地SMTP中繼
- 20. 在C中使用繼承#
- 21. 在PostgreSQL中使用繼承
- 22. 如果使用類中繼
- 23. 使用中繼器使用XML
- 24. NG-中繼器不工作的JSON
- 25. OpenAPI/JSON Schema中的多繼承/組合
- 26. 繼續更新Android中的新JSON
- 27. 使用繼承
- 28. 使用繼承
- 29. 使用繼承
- 30. 變量範圍在POE會話中如何工作?