Hi there,

I am looking for help with embedding PHP code into ASP file.

However uncool it may sound, I have to keep some of my ASP pages, generated by MS Front Page untill I migrate them to PHP/MySQL.

At the moment I need to use $page_title php var in my ASP pages, the same way I use it in my PHP pages.

So is there any way we can embed PHP code inside an ASP file?

Thanks,

phper2

    Can you treat it like embedding php in a regular HTML page?
    <%
    ASP STUFF
    %>
    <title><?php echo $page_title; ?></title>
    <%
    MORE ASP STUF
    %>

    Any chance that could work?

      You cant exactly embed PHP into an ASP Page it just wont work, I dont know anything about ASP but I am sure they have some method of communicating with another language.

        If that is all you need to do, I don't really see the need to embed PHP within ASP.

        From what I know, only VBScript and JScript are supported by ASP. ASP.NET supports more, but I don't think PHP is in the list of supported langauges.

        Possible option:

        If you have CGI binary, and access to it, you could invoke PHP scripts within ASP, and return output. Or vice versa (I don't know if ASP can be executed via command line). Just do in ASP:

        (pseudo code)

        execute path/to/php -q scriptname.php
        get return data and assign to variable
        

        And all your PHP code need do is

        echo $page_title;
        

        However, that will not work it php is installed as an apche module.

          Can't you just pass vars from asp to js and from there to php?
          I don't know how to do it but I know both langauges support js.

            Write a Reply...