Various questions about interacting PHP and ASP

Discussion in 'ASP .Net' started by David Thole, Aug 9, 2006.

  1. David Thole

    David Thole Guest

    Hey all,

    So far my reading is proving to be very interesting and good. This
    book is very helpful, and I'm generally left with quite a few questions
    about how I'm going to do stuff with my current setup. Basically
    speaking, all my stuff is currently in PHP. I need the ability for
    being able to interact with PHP quite a bit. My largest question right
    now, is say that I want to provide some information from my PHP form to
    the asp one for other processing. There were two options I suppose for
    this:

    1. Using vars in the URL (Sorry, I can't think of the term now, for
    the life of me - post or request var handling...) such as
    http://www.foo.com/?var1=value1&var2=value2....

    2. Using hidden input fields in the PHP, and using javascript links to
    "submit" the form to the ASP page.

    I'm not in the book where to deal with form information really
    effectively, but according to my reading at various sites, there's an
    option called Request.Form where one can set the variables. From what
    I also understand so far, using the VIEWSTATE variable is possible to
    keep that data for future postbacks as well. So I suppose my questions
    are best asked:

    1. Which is the best method above for passing variables to the ASP
    form. Can #1 be done at all? Is there another option that's better?
    These will be on separate servers obviously, on paid hosting so sharing
    data may be near impossible except at a database level (I'm not 100%
    sure on that at this point)

    2. If I wanted to keep that information, say their login information
    to the site, I'm used to using session variables. instead of that, is
    the viewstate the better option? How do I assign values to that (I
    haven't seen that in the book yet)

    3. I'm also thinking of enabling more logging across my entire site,
    which will be using PHP and ASP both (I plan on a subdomain being
    windows, while the main being PHP). Since the two can't share
    information, and calling to the database every page load or problem can
    slow down the system for not only me but others, is there a decent way
    to talk to each other? I was thinking of the PHP handling all the
    error logging in an SQLite file, and running a PHP file that can accept
    variables for the error type, and message (using rawurlencode), which
    then the PHP file would insert the needed data. Is there a way in ASP
    to just call a specific URL, not to direct to it, or show it in any
    way, but just to open it, and close it again? I know in PHP, I can just
    use fopen to a url, then close again...but ASP I don't know very well.

    Thanks for any help on this. Any suggestions on helping me learn better
    would be nice too if you don't mind :) I have a long ways to go in
    this language, but am kinda thinking about what I'd like to do
    eventually. Once I get about half way through this book, I hope to
    finally start to build some decent ASP pages. Kinda taking that part
    slow, but trying to absorb so much fairly fast which may be a mistake,
    I'm not sure at this point. I'm pretty happy with the language so far,
    it's pretty nice.

    -David
    David Thole, Aug 9, 2006
    #1
    1. Advertising

  2. 1 -
    Both #1 and #2 will work. You can post/get to and from any scripting
    language to any other. The only problem with both #1 and #2 is if you need
    to pass any secure information, it'll be plainly visible. Also, don't trust
    the input..a user can easily change those values...so just because userId=3
    doesn't mean it's actually user 3!!!

    2 -
    The viewstate is serialized information, I doubt you can write into it with
    PHP..though someone might have already written the logic for it. In the
    end, it's just another hidden form field name __viewstate, but as I said,
    it's highly serialized so....

    3 -
    It sounds like more trouble than it's worth...I'll assume there's a good and
    actual requirement to be running the two frameworks, else just use one.
    Anyways, that point asside, using hte database to talk to each other isn't a
    horrible ideal. Yes, it will put some extra processing, but don't knock it
    until you try it..for what you are trying to do, it might be the most
    scalable and best solution all round. The .NET framework has amazing socket
    capabilities, including the WebRequest class which let's you easily hit
    another web-page from code on the server side. My guess is this is what
    you'd need:
    http://msdn2.microsoft.com/en-us/library/system.net.webrequest.aspx

    Karl
    --
    http://www.openmymind.net/
    http://www.codebetter.com/


    <David Thole> wrote in message
    news:...
    > Hey all,
    >
    > So far my reading is proving to be very interesting and good. This book
    > is very helpful, and I'm generally left with quite a few questions about
    > how I'm going to do stuff with my current setup. Basically speaking, all
    > my stuff is currently in PHP. I need the ability for being able to
    > interact with PHP quite a bit. My largest question right now, is say that
    > I want to provide some information from my PHP form to the asp one for
    > other processing. There were two options I suppose for this:
    >
    > 1. Using vars in the URL (Sorry, I can't think of the term now, for the
    > life of me - post or request var handling...) such as
    > http://www.foo.com/?var1=value1&var2=value2....
    >
    > 2. Using hidden input fields in the PHP, and using javascript links to
    > "submit" the form to the ASP page.
    >
    > I'm not in the book where to deal with form information really
    > effectively, but according to my reading at various sites, there's an
    > option called Request.Form where one can set the variables. From what I
    > also understand so far, using the VIEWSTATE variable is possible to keep
    > that data for future postbacks as well. So I suppose my questions are
    > best asked:
    >
    > 1. Which is the best method above for passing variables to the ASP form.
    > Can #1 be done at all? Is there another option that's better? These will
    > be on separate servers obviously, on paid hosting so sharing data may be
    > near impossible except at a database level (I'm not 100% sure on that at
    > this point)
    >
    > 2. If I wanted to keep that information, say their login information to
    > the site, I'm used to using session variables. instead of that, is the
    > viewstate the better option? How do I assign values to that (I haven't
    > seen that in the book yet)
    >
    > 3. I'm also thinking of enabling more logging across my entire site,
    > which will be using PHP and ASP both (I plan on a subdomain being windows,
    > while the main being PHP). Since the two can't share information, and
    > calling to the database every page load or problem can slow down the
    > system for not only me but others, is there a decent way to talk to each
    > other? I was thinking of the PHP handling all the error logging in an
    > SQLite file, and running a PHP file that can accept variables for the
    > error type, and message (using rawurlencode), which then the PHP file
    > would insert the needed data. Is there a way in ASP to just call a
    > specific URL, not to direct to it, or show it in any way, but just to open
    > it, and close it again? I know in PHP, I can just use fopen to a url, then
    > close again...but ASP I don't know very well.
    >
    > Thanks for any help on this. Any suggestions on helping me learn better
    > would be nice too if you don't mind :) I have a long ways to go in this
    > language, but am kinda thinking about what I'd like to do eventually.
    > Once I get about half way through this book, I hope to finally start to
    > build some decent ASP pages. Kinda taking that part slow, but trying to
    > absorb so much fairly fast which may be a mistake, I'm not sure at this
    > point. I'm pretty happy with the language so far, it's pretty nice.
    >
    > -David
    >
    Karl Seguin [MVP], Aug 9, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella

    VHDL: various questions and issues...

    Neil Zanella, Nov 17, 2003, in forum: VHDL
    Replies:
    2
    Views:
    3,854
    Charles M. Elias
    Nov 17, 2003
  2. Fabian Steiner
    Replies:
    2
    Views:
    651
    Fabian Steiner
    Feb 28, 2006
  3. Rajive Narain
    Replies:
    0
    Views:
    1,576
    Rajive Narain
    Sep 18, 2009
  4. ZMZ
    Replies:
    1
    Views:
    689
  5. q-rious
    Replies:
    2
    Views:
    831
    Manuel Collado
    Mar 13, 2011
Loading...

Share This Page