471,089 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

Various questions about interacting PHP and ASP

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

Aug 9 '06 #1
1 1406
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/lib...ebrequest.aspx

Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
<David Tholewrote in message
news:20******************@News.GigaNews.Com...
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

Aug 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Garmt de Vries | last post: by
2 posts views Thread by wireless200 | last post: by
8 posts views Thread by Chun Wang | last post: by
1 post views Thread by jason | last post: by
reply views Thread by Jobs | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.