How can PHP be used to extract IP addresses from a website?

To extract IP addresses from a website using PHP, you can use regular expressions to search for IP address patterns within the website's content. By using the `preg_match_all` function in PHP with a regular expression pattern for IP addresses, you can extract all IP addresses found in the website's content.

$url = 'https://www.example.com';
$content = file_get_contents($url);

$pattern = '/\b(?:\d{1,3}\.){3}\d{1,3}\b/';
preg_match_all($pattern, $content, $matches);

$ipAddresses = $matches[0];

foreach ($ipAddresses as $ip) {
    echo $ip . "\n";
}