dez — 2012-03-18T18:20:19-04:00 — #1
Is there a safe way to do php includes from internal and external websites please? A way where the webhosts wouldn't need to worry?
ralphm — 2012-03-18T18:53:42-04:00 — #2
As far as I know, internal includes are quite safe, and external ones are not available.
dez — 2012-03-19T03:17:13-04:00 — #3
Thanks Ralph. Anyone know for definite?
anthonysterling — 2012-03-19T05:09:48-04:00 — #4
include supports remote paths, but I'd be more comfortable if this was some sort of API. Do you have a use-case ?
starlion — 2012-03-19T06:49:50-04:00 — #5
Mmmh.. include allows remote paths, but it should be pointed out this will NOT return PHP-execute script... it will just return the HTML result of the remote script. If it did, every PHP site in the world would be easily hackable.
samanime — 2012-03-19T08:26:04-04:00 — #6
As StarLion said, it's possible, but not how you may expect.
A use-case would definitely be helpful. There is very little reason not to use an API nowadays. They are incredibly easy to build (for simple things) and rather reliable.
system — 2012-03-19T10:45:51-04:00 — #7
Meanwhile I'm not even sure I follow the question -- I'm assuming by 'external' you mean 'remote' and by 'internal' you mean 'local'?
NOT that 'remote' (as in off server) includes should even be ALLOWED.
samanime — 2012-03-19T12:45:58-04:00 — #8
I can see remote includes being allowed, but in the context of an intranet (though even then, I still prefer free-standing APIs to a complex mix of PHP files leaving on several servers).
dez — 2012-03-19T14:34:57-04:00 — #9
Thanks to all for the help and ideas on this it's really appreciated. So, retrieving contents from an external website, is possible, but the only way to do it, is by API's - is that about right please? Or are there other ways? Use case?
samanime — 2012-03-19T17:11:23-04:00 — #10
The -only- way... no.
The way 99% of developers who know what they are talking about would recommend: yes.
Basically an API is meant for exactly that: joining two independent systems.
For example, I have a site which uses the logins from a different system. In order to authenticate, we have a web service (an API) which I call to ask that server for the information I want in order to know if I should let the user log in or not. Afterwards, I can ask it other things like information about that user.
ralphm — 2012-03-19T17:59:10-04:00 — #11
As others have said, a use-case would be good (that is, a description of what you are trying to do here). I recently found out how easy it is to pull in data from an remote RSS feed (from another site) onto a page with PHP.
system — 2014-10-07T22:08:45-04:00 — #12
This topic is now closed. New replies are no longer allowed.