How to get C # to talk to a PHP session

I have a C # web application that I want to integrate with a PHP cart, is this possible?

+1


source to share


5 answers


This is not possible unless it is in the database and you are writing a serialization algorithm (de) that works between both languages. If it should be read-only, I would make it read-only for the user.



If it is stored on the file system, I consider it unsafe to access it.

+2


source


It really depends on the details. Do you want a PHP application to run in your .NET environment? If I had a look at Phalanger but I don't think it will work the way you want it to.

You can also look at PHP on IIS , but that doesn't give you much information either.



As annakata mentioned, I am assuming that you are better off calling / redirecting to / from a PHP script to your ASP.NET website.

And I have a feeling it's not easy to do, so ... you're in luck;)

+2


source


Well, you need to describe the snippets in more detail, but it won't be trivial if possible.

How about Response.Redirect to cart.php? inputparams = foo -> do work -> PHP redirect to thankyou.aspx? inputparams = bar

Can you use PHP as a service?

Or request PHP output as HTTPWebRequest?

0


source


There are several options here. While Java has more options for integration, especially for sessions, C # /. Net will likely rely on other communications products.

If it was background processing (like processing completed orders after checkout), this would probably be easier. However, you want to mix web applications. How and what you want to mix, they can (and probably will) do it quite hard - or at least in uncharted waters. PHP runs under Apache and .Net web applications under IIS.

You will have to go through a different technological level. Others have mentioned databases, but this is not a viable or efficient solution for storing sessions in real web applications.

Your best bet is probably memcached , for which there is at least one C # client library. Here is an example cross platform serialization using memcached .

beanstalkd can also be considered appropriate if you have background work processing. It is a distributed work queue process with multiple client libraries (e.g. Ruby, PHP, Perl, Erlang). I couldn't see the C # version, but it probably could be done. See Documentation.

I mention this because you might have a PHP request to work with beanstalkd, not a C # poll or a PHP session poll.

-1


source


PHP stores its session in files. The client cookie contains the filename, php.ini contains the path.

It is relatively easy to access php session data from dotnet. I'm looking for a library that does this, but if I can't find it, I'll write it myself.

-1


source







All Articles