Sending a PHP object to another PHP page

I'd like to know if there's a way by which a PHP object could be sent to another PHP page on a different machine?

For instance - I've implemented a class that constructs a Trie. Now after the Trie has been constructed , I'd like to send across the object to another PHP page so that it can access the object too.

Would probably packaging it into some sort of encoded JSON request and then sending it to a page which could relay it to the required page using jQuery , be a feasible option ?

I'm sorry I'm absolutely new to this !

Will Appreciate any help provided.

Cheers!

Answers


An object is an instance of a Class. Objects can't be sent around as they are. A "transmissible" object must be Serializable: make sure that your class implements Serializable

Once you've implemented the interface, just call the serialize and deserialize methods to get the object-string and to rebuild the object


Need Your Help

How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?

python ruby linq functional-programming

Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language su...

How can I functionally iterate over a collection combining elements?

scala scalaz

I have a sequence of values of type A that I want to transform to a sequence of type B.