« Previous Next »

Thread: <? PHP CODE in ASP ?>

Last post 05-16-2006 5:59 AM by CourtenayProbert. 7 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (8 items)

Sort Posts:

  • 04-04-2006, 6:31 AM

    <? PHP CODE in ASP ?>

    Hi,

    Like multiple Servers support ASP & PHP, can I include both code in 1 ASP file ?

    Regards.

    Pablo Tilotta

    www.estoyenojado.com

    www.seontop.com

  • 04-04-2006, 8:13 AM In reply to

    • SomeNewKid
    • Not Ranked
    • Joined on 08-10-2003, 12:16 AM
    • Western Australia
    • Posts 0

    Re: <? PHP CODE in ASP ?>

    Sorry, but the answer is no.  You cannot include both types of script in a single page, and have both processed separately.
     
  • 04-21-2006, 5:19 AM In reply to

    Re: <? PHP CODE in ASP ?>

    How about two different script files communicating with each other, eg a php file transfering data to an asp file?
  • 04-21-2006, 9:18 AM In reply to

    • SomeNewKid
    • Not Ranked
    • Joined on 08-10-2003, 12:16 AM
    • Western Australia
    • Posts 0

    Re: <? PHP CODE in ASP ?>

    florian_mrt:
    How about two different script files communicating with each other, eg a php file transfering data to an asp file?
    Yes, you can do this.

    Both PHP and ASP process "incoming HTTP requests".  So, if you can get the data into an HTTP request, then you can pass whatever information you like between your PHP files and your ASP files.  This means attaching the data to a querystring value, or "posting" a form from the PHP page to the ASP page, or visa versa.  That is, the form in the PHP file can have an action value of the ASP page (<form action="process.asp">), so that the form data in the PHP page is posted to the ASP page.  And the reverse would work, too.

    Another option you have is to save the data either to a text file or to a database, so that both your PHP and your ASP pages can work with the same data.

    Yet another option is to put some data into a cookie.  If the data is not large, and if both your PHP and ASP pages are on the same domain, this would work.

    Another option again to share Session data between your PHP and ASP pages.  I've never done this myself, but this page links to an article about it.  The article was unavailable when I tested the link, but it may come back online.

    A final option is that you might choose either PHP or ASP, and simply translate those pages that are in the "other" technology.  This might prove to be less work than trying to maintain a website using two separate technologies.
     

  • 04-21-2006, 10:12 AM In reply to

    Re: <? PHP CODE in ASP ?>

    Cheers, an interesting number of choices, and an interesting point to discuss.

    How about calling a specific function in PHP? I think that would work if you had a PHP function-controller first that would find a specific function upon a passed variable, and return the result in maybe a serialized way if the result is an array.

    Talking about PHP serialization, is there a function in that exists in ASP to unserialize a PHP serialized dictionary (array)?

     

    The choices you gave, aren't arguably the 'technically cleanest' number of choices apart from the database one, and probably less faster than one would want to. How about memory allocating? Its possible in PHP, how about ASP? Has anyone tried or did some research into this?

  • 04-21-2006, 11:00 AM In reply to

    • SomeNewKid
    • Not Ranked
    • Joined on 08-10-2003, 12:16 AM
    • Western Australia
    • Posts 0

    Re: <? PHP CODE in ASP ?>

    florian_mrt:
    The choices you gave, aren't arguably the 'technically cleanest' number of choices apart from the database one, and probably less faster than one would want to.
    If this is the case, it is because I misunderstood your question.  I figured you meant that the user sees an ASP page, and then sends that page to a separate PHP page for processing (or visa versa).  But I now understand that you want both the ASP page and the PHP page to be processed together, without requiring the user to send one page to the other.  In this case, all options are still available, but you are right that other than the database they are "fudges"--and slow ones at that.

    Okay then, let's look at what this means.  The difficulty you have is that ASP and PHP are both script-based technologies that require an executable to be processed.  Normally it is the task of IIS to hand the .asp or .php file to the executable, and accept the HTML that results.  In your case, your own ASP or PHP code somehow needs to do the same thing: hand the .asp or .php file to the executable, and accept the HTML that the executable that it produces.  If this is your own server, then this may be possible.  But if this is a shared commercial host, then your ASP or PHP code simply won't have the security permissions to do this.

    Now I do not use either PHP or ASP.  I answered your first question because I happened to be the moderator that approved it, and I knew the answer to your first question.  But I don't have the experience necessary to answer your questions about PHP serialization or memory allocation.  I'm sure that, technically, you could achieve anything you want if you work hard enough at it.  But I think that you should first investigate whether you can simply choose one technology, and translate those few pages that use the "other" technology.  It would seem to provide the smoothest path for the future.
     

  • 04-24-2006, 8:34 AM In reply to

    Re: <? PHP CODE in ASP ?>

    You are quite realistically right in mentioning that one better has to choose either ASP or PHP for whatever need it was that requested the solution. But in terms of designing large systems for extended computer systems, the choice isnt there sometimes. You will have to take into account that at some stage, UNIX based servers will be the only hosting option. Which is not a problem, as you then decide to create your solution system in PHP (or Perl or ...). Oddly, I recently have 'a client' that wants me to write an ASP-based website for him (with SQL 2005 Express, but thats a different (silent) topic). Not a problem (apart from the DB), it doesnt need any of my already designed PHP-systems for this particular purpose.

    But it does let me wonder, what if I DID need my already designed systems, written in PHP? Its OK for a complete PHP-to-ASP translation for some thousand lines-scripts, but you aren't going to bother for several year's work worth of lines ! As well, you want to keep all the information processing clean and organized, meaning in one same system which you developed on hugely in the past. Not in two separate systems, which then means you have twice as much maintenance to do!

    In such a case, a solution to make ASP and PHP talk to each other fast and clean without using the alternative of storing the data somewhere between these two scripts, would be like Belgian Chocolate on Vanilla Ice Cream (with a bit of fresh Cream).

  • 05-16-2006, 5:59 AM In reply to

    Re: <? PHP CODE in ASP ?>

    Check out:

    http://php4mono.sourceforge.net/

    It won't help with Classic ASP but will facilitate mixing PHP with ASP.NET (on the Mono framework).


    Courtenay Probert
    http://www.probert.me.uk




Page 1 of 1 (8 items)