QUOTE(MrLeN @ Nov 28 2004, 03:25 AM)
It doesn't seem to work.
In this example, your server isn't parsing the PHP code. Make sure you've got it set to push .html files through the PHP interpreter (lots of posts around here on how to do that in Apache, I have no idea about IIS - besides, Apache's better and quite literally infinitely cheaper)
Cross-server includes have been in PHP since the later versions of PHP 3, I believe. I'm pretty sure they weren't in PHP/FI. That said, maybe they weren't available until PHP4. I wouldn't upgrade to PHP5 yet, personally.
This from php.net:
Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files via this function, even if allow_url_fopen is enabled.
As for including asp pages.. I've never had to do that. How I'd do it, I think, would depend on how the cross-server include works. I've never used the cross-server capability of include, but php.net has this to say:
If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix L for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
If I'm interpreting this correctly, in plain english it means:
When you're including
a file from a remote server, the remote server will parse the file and then send you it's output.
That means you don't have to parse the file yourself. So you should be able to go ahead and include .asp pages with a regular PHP include call, i.e.:
And you'll get regular HTML code back, which your PHP script can just print or echo to the browser.
Also, it would seem from the documentation that you can pass remotely-included files variables, so you could do something like:
And the remote server will process that normally. I'm guessing that the HTTP_REFERER (sic) given to the remote server would be the address of the PHP script on your server that's doing the includes.
Anyway, the upshot of all this geek-talk is this:
1) ensure your web server is parsing .html files as PHP scripts. (this is pretty important as without it, you'll get somewhat less scripting achieved than you want
2) You can include asp, html and php files remotely with PHP's [b]include[b] statement and all you'll get back is regular HTML.
3) Because of (2) above, you cannot (I think) execute a script written remotely on your server. Depending on what your needs are, this may or may not be important.
Sooooo.. I hope that was of some help =)
Edited by BobetteKyle, 12 January 2005 - 05:08 PM.