PHP View Source
Moderator: General Moderators
-
truepal20032001
- Forum Commoner
- Posts: 27
- Joined: Mon Jun 25, 2007 8:28 pm
PHP View Source
Hello, I want for PHP to look at the source of another PHP file in terms of its HTML output...Meaning that i cannot use fopen() because it will actually get the PHP source, I want it to get the source as if the page were already executed... and all you could get is the HTML source. It is possible to do it fopen() if it was not on my server, but since it is, it grabs the PHP source instead...
Re: PHP View Source
You can use fopen() actually. Just remember to use a full URL like "http://www.example.com/path/to/script.php" rather than just script.php. file_get_contents() is probably easier mind you. You'll still need the full path.
In theory you could always get the PHP source and just eval() it too, but that'd be a bit dodgy from a security point of view.
In theory you could always get the PHP source and just eval() it too, but that'd be a bit dodgy from a security point of view.
-
truepal20032001
- Forum Commoner
- Posts: 27
- Joined: Mon Jun 25, 2007 8:28 pm
Re: PHP View Source
I tried ur method also, but it still does the same thing, do you think the only method of doing this is by viewing it through a proxy?onion2k wrote:You can use fopen() actually. Just remember to use a full URL like "http://www.example.com/path/to/script.php" rather than just script.php. file_get_contents() is probably easier mind you. You'll still need the full path.
In theory you could always get the PHP source and just eval() it too, but that'd be a bit dodgy from a security point of view.
Re: PHP View Source
I suspect that the problem then may be what you are doing with it. So... what are you trying to do with it? Perhaps you just need to include() the file?
Code: Select all
include('file.php');Re: PHP View Source
What you are asking is to parse the file the same way that a web server would parse it. Without doing a LOT of programming, I don't see how you could do that. It might help if you explained why you want to do this.