1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Calling a PHP file/page on a .aspx file

Discussion in 'C#' started by lendl, May 10, 2006.

  1. #1
    hey there.. i keep on searching the web for articles regarding running a php file inside a .aspx code. the only thing i can see is calling a .aspx file on a php code.. but is it possible, calling a php file inside a .aspx code? thanks for all the help! :D
     
    lendl, May 10, 2006 IP
  2. DanInManchester

    DanInManchester Active Member

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    It depends what you are trying to achieve but in short yes!
    Where is this PHP file located on a remote server?

    You could potentially use the execute method or you may have to do a little more legwork such as using System.Net.WebClient and the openread method.
     
    DanInManchester, May 11, 2006 IP
  3. lendl

    lendl Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The file is actually located on the same server. Whats the best syntax to use to call a php page.
     
    lendl, May 11, 2006 IP
  4. DanInManchester

    DanInManchester Active Member

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    well like I said it really depends on wat you are doing with it but here is a simplistic example that gets a url and writes out the response

            Dim web As System.Net.WebClient = New System.Net.WebClient
            Dim sr As System.IO.StreamReader
            sr = New System.IO.StreamReader(web.OpenRead("http://www.dbnetsolutions.co.uk"))
            Response.Write(sr.ReadToEnd)
    Code (markup):
     
    DanInManchester, May 11, 2006 IP
  5. lendl

    lendl Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks dan! will do try it out.
     
    lendl, May 11, 2006 IP