getButterfly Logo getButterfly

If you have a script on a remote server and you are using PHP5, then you will not be able to use include() or require().

I learned that while trying to include a script on a subdomain (for speed).

The only solution is to use the file_get_contents() function instead.

That’s all. Your remote inclusion will now work.

Also view official documentation.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

5 thoughts on “Include Remote Files With PHP

  1. Haha that was the shortest blog post I have ever seen.

  2. Thank you.

    I’ve been wondering how to do this for a while.

    I am developing an API, for which we require remote HTML data.

Leave a Reply

Your email address will not be published. Required fields are marked *