Re: PHP Scripts in an ASP Page
From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 02/22/04
- Next message: George Hester: "Re: IIS 5 and .NET"
- Previous message: Darren Heinrich: "Have I been hacked ?"
- In reply to: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Next in thread: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Reply: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 21 Feb 2004 23:22:40 -0800
Ah, what you do not realize is that two script language systems aren't
necessarily automagically interoperable.
ASP has the ability to use configurable script language engines like
JScript, VBScript, Python -- the proper way to do this is to define an
interface to abstract language specifics from the web execution context
offered by ASP -- and JScript, VBScript, Python, etc have implemented such
an interface. What you're saying is that PHP doesn't implement such an
interface, so it cannot interoperate in the manner you want. This is just a
limitation in PHP.
So, I think your current homegrown "solution" is the best that you can do.
You've basically inserted an obfuscation layer with your NAT, so now you
need to implement hacks everywhere to "revert" your obfuscation. A load
balancer probably would have done the same thing you wanted, but without the
obfuscation layer to revert.
Finally, I'd like to make an alternative interpretation of your statement:
"the PHP function is so much simpler to implement, and so much more
transportable to another server...". I must apologize up front for being
blunt -- I'm not trying to be arrogant, belittle, etc -- I'm just trying to
give you more info and dispel misconceptions.
Ultimately, the same network API gets called to implement the Host/IP lookup
functionality. The difference is that one is plugged into a proprietary PHP
library interface, and the other to a proprietary COM interface. I see
nothing "simple" or "transportable" about it... other than a subjective
opinion. For example, I personally prefer the COM interface because it's
more supported and reusable than PHP. Any script language on Windows
natively support it (via interfaces), C-based DLLs can extend server
functionality with it, .Net directly interoperates with it in both
directions, and Perl can make COM calls as well. Also, what you're doing
can also be implemented via a "WebService", which would be a one liner to
add to the ASP page to invoke, and a one liner in ASP.Net to implement your
functionality. The simple "Web Service" would be far more
standards-preserving and as simple to implement as your PHP page. Etc.
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Lance Clarke" <anonymous@discussions.microsoft.com> wrote in message
news:923E3A59-3497-40D1-98EE-272E5B0C6ACA@microsoft.com...
Thanks David.
The particular server that I need to do this on is behind NAT, so
Request.ServerVariables( "LOCAL_ADDR" ) returns only the internal private
IP. I need to return the external public IP of the router. I have a
home-grown utility that updates my DNS servers when ever the public IP
changes, so it really is the DNS server I need to query.
I am currently doing this with a home-grown COM object that I wrote in VB,
and it works just fine. However, the PHP function is so much simpler to
implement, and so much more transportable to another server, that I would
really like to find a simple way to use it.
This works:
Global.asa:
...code code code...
Response.Redirect "DNSLookUp.php?Host=www.myhost.com"
DNSLookUp.php:
<?
setcookie("IP", gethostbyname($_GET["Host"]));
header('location:\Index.asp');
?>
Index.asp:
...code code code...
<? =Request.Cookies("IP") ?>
That works, and is much simpler than having to install a COM object. But it
certainly could be simpler yet.
Why doesn't:
<Script RunAt=Server Language=PHP>
...code code code...
</Script>
work?
I just get the error: "The scripting language 'PHP' is not found on the
server."
If I read the Python example correctly, then a properly installed
interpreter should work like this within an ASP page. And I do have PHP
properly installed and configured, because it is working fine in all other
applications. I just can't seem to get it to work in-line.
Thank you in advance for all your assistance.
- Next message: George Hester: "Re: IIS 5 and .NET"
- Previous message: Darren Heinrich: "Have I been hacked ?"
- In reply to: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Next in thread: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Reply: Lance Clarke: "Re: PHP Scripts in an ASP Page"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|