allow_url_include is there a way to allow includes from just one Url. maybe with Htaccess or in the PHP?
allow_url_include is there a way to allow includes from just one Url. maybe with
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. To fetch the contents of a URL, use
file_get_contents(). Then, to send the result back to the waiting browser, just useecho().The above will require that you set config
allow_url_fopen=1(which is already set by default).If you were to use
include, instead of the approach I’ve shown above, there would be one major difference:includealso executes any PHP code it finds inside the fetched document. In general, this is a really dangerous thing to allow unless you know that you control 100% of the contents of the document being included.That said: if you do want code that works exactly like
include, you can do something like the following (which is safer because it only fetches a single URL, and it doesn’t require you to enableallow_url_include).If you choose do this, be certain that you control the full contents of the remote URL. If someone else controls that file, they will be able to execute arbitrary code on your server. Don’t let that happen.