-
doing the undoable
here's my situtation, I already have pages set up on my site using asp. I need to include those pages with my master index.php page. Is there a way to include an asp page in a .php document, basically any way to render both php and asp. The only was I did it so far was with an inline frame :rolleyes:
-
Well you can't have the PHP parser execute the ASP pages - but you can use the fopen() function to open the page and get the output.
PHP Code:
$fhwnd = fopen('http://www.mysite.com/index.asp');
if ($fhwnd) {
/* discard headers */
while (! feof($fhwnd) && fgets($fhwnd) != "\r\n");
$output = '';
while (! feof($fhwnd)) {
$output .= fgets($fhwnd);
}
}
-
that does help with some stuff, but I want to use a php referer log script on an asp page, but I think I'll just find an asp logger with referer.
-
I would recommend switching everything to PHP. It's generally not a good idea to mix languages like those 2.
-
Yeah - ober is right. Go with either one or the other.
I suppose it would be possible to mix them both if you were able to find a way of puting the file through both an PHP interpreter and the ASP interpreter afterward. I know this would be possible on linux but wouldn't have the first clue how to do it with Windows/IIS.
-
I tried the code, it returned
Warning: fopen() expects at least 2 parameters, 1 given in c:\websites\*\www\index2.php on line 48
-
Sorry. I left out on of the arguments. The call to fopen should read:
PHP Code:
$fhwnd = fopen('http://www.mysite.com/index.asp', 'r');
-
now there's no errors, but the page is blank, nothing comes up. Do I have to do something special to write it back to the page?
-
Yes.
echo $output;
is the simplest version. Basically, $output contains everything the ASP page produced.
-
I'm so sorry, I realized I could include http://domain.com/blah.asp and it will render it first. I'm so stupid. I'm really sorry you wrote that whole fopen script, sorry for the trouble. I may end up using it somewhere along the line, thanks anyway.