Serialize a File for Webservice

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tekgrunt
Forum Newbie
Posts: 2
Joined: Wed Jul 02, 2008 3:38 am

Serialize a File for Webservice

Post by tekgrunt »

I have written a client in c# that communicates with my webservice that I have written in PHP accessing mySQL. I am using SOAP to communicate. Everything works great... but now I would like to take a file on the server, serialize it and send it back to my client embedded in the XML.

I have had no luck finding any information on serializing a file. From what I have read you cannot serialize a resource. There must be a way to read out a file and serialize the bitstream... any help, ideas or suggestions regarding this would be greatly appreciated.
tekgrunt
Forum Newbie
Posts: 2
Joined: Wed Jul 02, 2008 3:38 am

Re: Serialize a File for Webservice

Post by tekgrunt »

I think I may have a solution... I am just going to open the file into an array ($lines = file('http://www.example.com/');) and then serialize the array. Nt the slickest solution but i think it will work... to make things easier on the client I could append this array into a giant string before serializing it but I am not sure about size restrictions for strings in PHP.

Sometimes you just need to talk something out to get the solution... I think they call that rubber-ducking.
Post Reply