470,636 Members | 1,566 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Using PHP and ASP in a single source file?

I'm a software engineer but pretty naive about web programming/scripting.
I'm working with a server running Windows IIS. I have several ASP files and
several PHP
files (not developed by me) that all work fine on the server. There's a
little ASP that's to be put at the top of every page, which of course works
fine for the .ASP pages. Now, if I want
to include this same snippet of ASP code at the top of one of the PHP files,
is that possible?
If so, what would the extension of the "mainly PHP" file be? If the
extension is PHP, the ASP won't be recognized, and vice-versa. That's what
I'm experiencing anyway.

Thanks,

Dan

Jul 19 '05 #1
4 5758
"Dan S" <da******@sbcglobal.net> wrote in message
news:bl************@ID-207392.news.uni-berlin.de...
I'm a software engineer but pretty naive about web programming/scripting.
I'm working with a server running Windows IIS. I have several ASP files and several PHP
files (not developed by me) that all work fine on the server. There's a
little ASP that's to be put at the top of every page, which of course works fine for the .ASP pages. Now, if I want
to include this same snippet of ASP code at the top of one of the PHP files, is that possible?
If so, what would the extension of the "mainly PHP" file be? If the
extension is PHP, the ASP won't be recognized, and vice-versa. That's what
I'm experiencing anyway.


The way I understand it, a file's extension tells IIS to use a particular
DLL when working with a file. Unless you have a DLL that reads both ASP and
PHP, I doubt that you can do this. I don't think such a DLL exists either.

My suggestion is to find out which code is easier to convert to the other,
and settle with either PHP or ASP.

--
gorf
Jul 19 '05 #2
TJS
it's one or the other, bu tnot both.

PHP can use COM, so you could put the snippet into a component then it could
be used by both PHP and ASP
--
================================
http://www.ASPkey.net/
A Resource Site for Web Developers
*Free OnLine web Tools
*Free development services
================================

"Dan S" <da******@sbcglobal.net> wrote in message
news:bl************@ID-207392.news.uni-berlin.de...
I'm a software engineer but pretty naive about web programming/scripting.
I'm working with a server running Windows IIS. I have several ASP files and several PHP
files (not developed by me) that all work fine on the server. There's a
little ASP that's to be put at the top of every page, which of course works fine for the .ASP pages. Now, if I want
to include this same snippet of ASP code at the top of one of the PHP files, is that possible?
If so, what would the extension of the "mainly PHP" file be? If the
extension is PHP, the ASP won't be recognized, and vice-versa. That's what
I'm experiencing anyway.

Thanks,

Dan


Jul 19 '05 #3

"gorf" <as*@for.it> wrote in message
news:bl**********@geraldo.cc.utexas.edu...
"Dan S" <da******@sbcglobal.net> wrote in message
news:bl************@ID-207392.news.uni-berlin.de...
I'm a software engineer but pretty naive about web programming/scripting. I'm working with a server running Windows IIS. I have several ASP files and
several PHP
files (not developed by me) that all work fine on the server. There's a
little ASP that's to be put at the top of every page, which of course

works
fine for the .ASP pages. Now, if I want
to include this same snippet of ASP code at the top of one of the PHP

files,
is that possible?
If so, what would the extension of the "mainly PHP" file be? If the
extension is PHP, the ASP won't be recognized, and vice-versa. That's what I'm experiencing anyway.


The way I understand it, a file's extension tells IIS to use a particular
DLL when working with a file. Unless you have a DLL that reads both ASP

and PHP, I doubt that you can do this. I don't think such a DLL exists either.
My suggestion is to find out which code is easier to convert to the other,
and settle with either PHP or ASP.

--
gorf


You could always use one system to read the other page. For example, if
index.php needed something out of index.asp. You'd have a block of code in
index.php that used file() to read http://yourserver.com/index.asp and then
used a preg_match to hack the resulting bit of HTML from index.asp and then
you could just echo that block wherever you wanted it to appear. If you
placed some HTML comment strings around the bit of ASP you wanted to hack it
would make the whole snipping job a lot easier.

For instance,

<?
$file = file_get_contents ("http://yourserver.com/index.asp");
preg_match ("/<!--{SNIP HERE}-->(.*?)<!--{STOP SNIPPING}-->/s", $file,
$matches);
echo ($matches[1]);
?>

^^ Note: Untested code ^^

It's a bit of a kludge and results in two pages running through your IIS but
it may be a workaround for your duality issue for the moment.

Paul
Jul 19 '05 #4
Or you could just use an <iframe>...
"Paulus Magnus" <pa***********@loves-spam.com> wrote in message
news:bl**********@sparta.btinternet.com...

"gorf" <as*@for.it> wrote in message
news:bl**********@geraldo.cc.utexas.edu...
"Dan S" <da******@sbcglobal.net> wrote in message
news:bl************@ID-207392.news.uni-berlin.de...
I'm a software engineer but pretty naive about web programming/scripting. I'm working with a server running Windows IIS. I have several ASP files
and
several PHP
files (not developed by me) that all work fine on the server. There's
a little ASP that's to be put at the top of every page, which of course works
fine for the .ASP pages. Now, if I want
to include this same snippet of ASP code at the top of one of the PHP

files,
is that possible?
If so, what would the extension of the "mainly PHP" file be? If the
extension is PHP, the ASP won't be recognized, and vice-versa. That's what I'm experiencing anyway.


The way I understand it, a file's extension tells IIS to use a

particular DLL when working with a file. Unless you have a DLL that reads both ASP

and
PHP, I doubt that you can do this. I don't think such a DLL exists

either.

My suggestion is to find out which code is easier to convert to the other, and settle with either PHP or ASP.

--
gorf


You could always use one system to read the other page. For example, if
index.php needed something out of index.asp. You'd have a block of code in
index.php that used file() to read http://yourserver.com/index.asp and

then used a preg_match to hack the resulting bit of HTML from index.asp and then you could just echo that block wherever you wanted it to appear. If you
placed some HTML comment strings around the bit of ASP you wanted to hack it would make the whole snipping job a lot easier.

For instance,

<?
$file = file_get_contents ("http://yourserver.com/index.asp");
preg_match ("/<!--{SNIP HERE}-->(.*?)<!--{STOP SNIPPING}-->/s", $file,
$matches);
echo ($matches[1]);
?>

^^ Note: Untested code ^^

It's a bit of a kludge and results in two pages running through your IIS but it may be a workaround for your duality issue for the moment.

Paul

Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by LP | last post: by
121 posts views Thread by typingcat | last post: by
4 posts views Thread by Horacius ReX | last post: by
1 post views Thread by Korara | last post: by
???
reply views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.