Sunday, 30 November 2014

PHP file_get_contents Function - Reads entire file into a string

string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )
Reads entire file into a string
This function is similar to file(), except that file_get_contents() returns the file in a string, starting at the specified offset up to maxlen bytes. On failure, file_get_contents() will return FALSE.

<?php
$homepage 
file_get_contents('http://www.example.com/');
echo 
$homepage;?>

5.1.0 Added the offset and maxlen parameters. 5.0.0 Added context support.

PHP mail attachment - sending an attachment with PHP