Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can I call asp program from PHP?

    I have a PHP program that accesses a database, does various functions and then I would like to call and pass data to an ASP program. I have it working via the html <a> command but would like to remove the html from the equation. Any ideas on how to automatically call and pass data to an asp program from PHP???????

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Hmm, and include perhaps? I remember we had this topic come up awhile ago, but cannot recall what was determined.
    Give that a shot, see if it works. Obviously you'll need to create a way to pass this information to be usable within the asp itself, whether it be like a request variable or through something like xml. So yes an no for your question, you cannot directly call asp within a php script, but you can process it however you would like and include it within your php.

  • #3
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Hmmm, I included the asp code within the php and it never executed the asp code. What I did was something like this

    <?php
    echo "This is a test email message<br>";
    ?>

    <%@ Language=VBScript %>
    <%
    Response.Write "Hello from ASP"
    %>

    <?php
    echo "Hello from PHP";
    ?>

    The output was
    This is a test email message


    Hello from PHP

    It never displayed "Hello from ASP", just a blank line.

    rocky10

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    you can't do it in the same request (though apache2 filters in theory could (though still not with asp))

    assuming a PHP enabled webserver with asp running on port 81 (or simply on a remote server)

    PHP Code:
    <?php
    echo "This is a test email message<br>";
    include( 
    'http://domain.com:81/asp.asp' ) ;
    echo 
    "Hello from PHP";
    ?>
    where asp.asp is your ...
    <%@ Language=VBScript %>
    <%
    Response.Write "Hello from ASP"
    %>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #5
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Noooo.............

    If this application is something your making for your job/client, or any other developer will ever have to deal with the code; DON'T MIX SERVER ENVIRONMENTS!

    I'm not just having a whinge here, I know exactly how it feels to inherit such an application as I am currently responsible for migrating 6 apps which use a foul concoction of PHP, ASP, Oracle and MySQL. I have the enviable task of making them PHP/Oracle apps and I can honestly say that if the developer responsible for these apps was still here (they're 5 years old), I'd happily wrap a very heavy piece of timber around his head with great force

    Please, please PLEASE!!! An extra 5-10 hours of your time now will save 100 hours of someone else's in the future (unless you plan on writing a 50+ page system design manual to accompany the app). If you can't see the value in that; there's no hope

    ..and don't even get me started on the joys of maintaining a multi-language environment!

    I take no responsibility for the above nonsense.


    Left Justified

  • #6
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, I took mindlessLenning's advice and rewrote the asp code in PHP. It works fine. Thanks for the help!!

  • #7
    New to the CF scene
    Join Date
    May 2005
    Location
    Houston, Texas
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Site Integration

    While having one language is ideal, some websites are made with a variety of pre-made scripts that need to be integrated together. It's much cheaper to pay $50 for a forum script, $50 for a directory script, $50 for a banner advertising script, use an open source shopping cart, etc. than to pay a programmer to build such common applications from scratch. All these programs need to be "integrated" to work together and it is quite easy to do in most cases if they are the same language. For example, I have integrated many of the above mentioned apps together on one website, creating one login that works for the entire website.

    All those applications are in ASP and I would like to start using some PHP applications on the website as well, but I would need to be able to pass variables back and forth between ASP and PHP to do so. Or the other alternative is to either figure out how or hire a more experienced programmer to write a PHP script that checks to see if they logged into the ASP portion of the website (i.e. making a PHP version of the ASP code that checks if a user is logged in).

    I know its a mess using several pre-made scripts for a website, but not everyone has a budget to hire a programmer or time to write yet another version of thousands of common applications. Plus, there are many good PHP scripts that I would like to use that I currently can't because the rest of the site is in ASP.

    If anyone has figured out how to work PHP and ASP together effectively, I would appreciate it if you post your ideas and solutions here. Thanks.
    Last edited by WisTex; 05-29-2005 at 10:46 AM.

  • #8
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If all you need to do is pas the variables back and forth between ASP and PHP then it shouldn't be too difficult, depending what you're trying to do that is.

    I don't know much about ASP but it uses cookies and so does PHP so that's the first thing that springs to mind. I also believe that they both handle query strings the same way (?var1=value&var2=value etc) so if you don't have much data to pass, using the URL could be the answer.

    Finding a way to maintain session state would be more difficult although still not impossible if you wrote your own custom session handler for each system, stored the session id in a database and passed it through the url or cookies.

    Really it all depends what data you need to pass and how it needs to be handled.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •