The function to use here is readfile("/path/to/my/php/scripts/on/webserver.php");
You might also want to set a header of Content-type: text/plain
Readfile does exactly what it says on the tin - it does not attempt to interpret the contained content, it simply passes it to the output stream. For this reason, while people commonly include() HTML in a PHP page, if it contains no PHP code you should use readfile() because it is quicker to run (it is not interpreted).
I would then in the calling page, put the PHP code into a <textarea></textarea> box so that the code can be viewed and easily cut + paste.
Be careful with the security of scripts like this - make sure you pass a numeric parameter, and convert this into a an array key which *looks up* the script filename. If you pass the filename direct, people *will* hack your web server to extract unexpected files you didn't plan on providing.
Cheers - Neil.
At 07:17 30/11/2003 +0000, you wrote:
I dunno, but how is it possible to grab local PHP source but not from another domain? I'd think it work in the same manner but guess there is something locking that out.
I own both domains and thought it be easier to have one domain for the code and one domain for displaying the code. So I could use the other domain to test with and users could also and the other domain for demo's on what to do to achieve things with PHP/mysql etc. Which Only I can edit.
I understand PHP has a ftp service in PHP, could this work to download the source?
Thanks for your time.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php