$file = "/path/to/file.txt"; $content = file_get_contents($file); echo $content;
$file = "/path/to/image.jpg"; $content = file_get_contents($file); header("Content-type: image/jpeg"); echo $content;
$file = "http://example.com/feed.xml"; $content = file_get_contents($file); $xml = simplexml_load_string($content); print_r($xml);This example reads the content of an XML file from a remote server and parses it into a SimpleXMLElement object. `getContent()` method is built-in function in PHP, which means it is included in the core PHP package library, so there is no need to install any external library to use it.