What are some common methods for controlling a modem over a COM port using PHP?

Controlling a modem over a COM port using PHP can be achieved by utilizing the PHP `dio` extension, which allows direct I/O access to devices. By opening the COM port associated with the modem, you can send AT commands to control the modem functions.

// Open the COM port associated with the modem
$port = dio_open('/dev/ttyS0', O_RDWR);

// Send AT command to the modem
dio_write($port, "AT\r");

// Read response from the modem
$response = dio_read($port, 1024);

// Close the COM port
dio_close($port);