Search code examples
phplimitfile-get-contents

Limit string loading by the file_get_contents


Is there any way to limit a number of characters that are loaded using the file_get_contents('http://myurl.com/');?

I need to load only first 500 characters from an URL to save the load time - is that possible? I've heard about method like this, but dunno if its feasible.


Solution

  • file_get_contents has a maxLen parameter that does exactly this.