|
-
Aug 20th, 2004, 01:24 AM
#1
Thread Starter
Junior Member
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
-
Aug 20th, 2004, 03:47 AM
#2
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);
}
}
-
Aug 20th, 2004, 05:13 AM
#3
Thread Starter
Junior Member
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.
-
Aug 20th, 2004, 06:54 AM
#4
Frenzied Member
I would recommend switching everything to PHP. It's generally not a good idea to mix languages like those 2.
-
Aug 20th, 2004, 07:08 AM
#5
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.
-
Aug 20th, 2004, 04:58 PM
#6
Thread Starter
Junior Member
I tried the code, it returned
Warning: fopen() expects at least 2 parameters, 1 given in c:\websites\*\www\index2.php on line 48
-
Aug 20th, 2004, 05:41 PM
#7
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');
-
Aug 20th, 2004, 06:06 PM
#8
Thread Starter
Junior Member
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?
-
Aug 21st, 2004, 04:59 AM
#9
Yes.
echo $output;
is the simplest version. Basically, $output contains everything the ASP page produced.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Aug 22nd, 2004, 06:22 PM
#10
Thread Starter
Junior Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|