7

Possible Duplicate:
including php file from another server with php

 <?php include('http://www.staticimages.co/legal-documents/fonts.php');?>

I'm trying to centralize a file that I will include in a few different domains. I've got a location but I'm unsure how to include the file. I've tried the above (which is the correct URL) but I get the following errors;

Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\wamp\www\flirtwithme.co\includes\legal\dating-safety-tips.php on line 15

Is there a preferred way to do this? Maybe CURL?

thx

0

3 Answers 3

11

Don't do this during runtime - it's terrible for security (the PHP code will have to be transmitted in clear text in order to be included) and performance (a HTTP call will take considerable time, and if the remote server is down or unreachable, your script will time out).

If you have to fetch content from a remote location, consider using a cron job that will fetch the data at regular intervals, or - maybe better - an active "push" solution using FTP for example, updating the file at multiple locations whenever it's updated.

For the cron job, you would indeed have to use curl (if it's installed), as your provider is disallowing access to http:// URLs from file functions.

Sign up to request clarification or add additional context in comments.

Comments

4

If you are aware of the security implications, you can enable the remote inclusion by setting the following in you php.ini:

allow_url_include = On

Comments

2

You can CURL your remote script and then eval().

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.