Can Use ASP inside PHP

Discussion in 'PHP' started by saami123, Jul 29, 2008.

  1. #1
    Hi

    can call ASP page inside PHP.

    please help

    by
    saami
     
    saami123, Jul 29, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Hi,

    You may be able to use HTTP remote includes:

    <?php
    include("http://www.yoursite.com/path/to/script.asp");
    ?>
    PHP:
    There may be better solutions than this.

    Jay
     
    jayshah, Jul 29, 2008 IP
  3. mallorcahp

    mallorcahp Peon

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I use the solution posted by Jay and works perfectly for me. Not only that, I then have PHP scripts inside the ASP page which also execute ... a check to see if user is logged in to display certain data, to do this I need to check for a cookie on the calling domain. Not sure if this is generically possible or only in my server set up but I tried it and it worked :)

    Another possibility might be to read the file into a string using file_get_contents.
     
    mallorcahp, Jul 29, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    That would only return the code, it wouldn't run.

    Jay
     
    jayshah, Jul 29, 2008 IP
  5. mallorcahp

    mallorcahp Peon

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    HMMMmmmm ... Not sure I agree Jay, unless it is on Windows Server running PHP and you pass it the absolute path.

    It would be a HUUUUUGE security breach if it did read the code ... you would be able to read the code of any asp script you wanted!!!

    For me, if you would pass the URI, i.e: file_get_contents("hxxp://domain.com/fileasp") would read the output of the script, not the script itself...
     
    mallorcahp, Jul 29, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #6
    I'm not sure what you mean.

    http://uk3.php.net/file_get_contents

    Imagine, it opens the file (imagine notepad for example), copies the code, and returns it. You see the source, it doesn't execute.

    Edit: I see what you mean. If you use HTTP, it's the same as my example [using include(); ] If you use relative (C:\file.asp or file.asp), then it'll read the source.

    Jay
     
    jayshah, Jul 29, 2008 IP