I have a text file that contains paragraphs of text. I want to load it as a string in php, and then collect all the e-mail addresses within it as an array. However, how do
file_get_contents
$lines = file('file.txt');
foreach ($lines as $line) {
// ...
}
$fileContent = file_get_contents($url);
Check the reference at http://php.net/manual/en/function.file-get-contents.php
The simplest way is file-get-contents!
$file_content = file_get_contents('/path/to/file');