Advertisement
dehqan

Untitled

Nov 10th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2.  
  3. $filename = "/dev/ttyUSB1";
  4.  
  5.  
  6.  
  7. if (!$handle = fopen($filename, 'r+'))
  8.  
  9. {
  10.  
  11. echo "The device isn't detected";
  12.  
  13. exit;
  14.  
  15. }
  16.  
  17. else
  18.  
  19. {
  20.  
  21. if (fwrite($handle, "AT") === FALSE)
  22.  
  23. {
  24.  
  25. echo "Command is sent";
  26. $reply = fread ($filename);
  27. echo $reply;
  28.  
  29. exit;
  30.  
  31. }
  32.  
  33. }
  34.  
  35.  
  36.  
  37. ?>
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement