The best solution is probably to process the
$homepage variable after it has been loaded. Have a look at String functions and regular expressions.
maxlen options that can be used to control what parts of the file get loaded, but
offset has behavior described by the documentation as “unpredictable” when used on non-local files as in your example.
maxlen is probably safe so you can use that to trim off the end if you know that what you want will be in the first N bites of the file. So, if you are certain that you only want the first 100 bytes of the homepage, you can do something like
file_get_contents ( 'http://www.example.com/', false, NULL, 0, 100). But unless you want exactly the first 100 bytes, you’ll still have to do some post-processing.
See http://php.net/manual/en/function.file-get-contents.php for more information. (Except for
maxlen these are the default values.)
solved How to extract only certain data with file_get_contents