File Operations
Instead of shell_exec('ls -l'), use:
$files = scandir('/path/to/directory');
$fileInfo = stat('/path/to/file');
Network Requests
Instead of fsockopen, use cURL:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
Directory Listing
Instead of shell commands, use:
// List files with glob
$files = glob('/path/to/directory/*');
// Recursive directory iterator
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator('/path/to/directory')
);