How to decode a xmlrpc binary object in php?

413 views Asked by At

I want to transfer some binary data over xmlrpc, from python on one end to php on the other end. The details are explained in this python example, especially the code on the server side handling the binary data:

from SimpleXMLRPCServer import SimpleXMLRPCServer
import xmlrpclib

def python_logo():
     with open("python_logo.jpg", "rb") as handle:
         return xmlrpclib.Binary(handle.read())

server = SimpleXMLRPCServer(("localhost", 8000))
print "Listening on port 8000..."
server.register_function(python_logo, 'python_logo')

server.serve_forever()

I would like to do almost exactly the same (except that I want to store the image on the server side), but in PHP (PHP 4.4.9 to be precise). I know how to use a xmlrpc server in PHP (even PHP 4), but I do not know how to 'convert' the binary data, sent by the Binary object on the python side, back to a file.

Or to ask in a different way: What is the PHP equivalent to pythons Binary object?

0

There are 0 answers