I believe that the simplest way to pass complex data from C# to PHP is through WCF service. See my previous post How to implement WCF service in PHP for more details.
Let assume we have a WCF service contract that has the following method with some nested dictionary as a parameter:
public interface IStore
void UpdateRows(Dictionary<int, Dictionary<string, object>> rows);
Below I provided the sample implementation of UpdateRows in PHP that iterates through nested dictionaries (first level called ‘rows’ and second level called ‘properties’):
Today I implemented my first PHP Web Service and successfully used it by C# client or, more precisely, I created WCF service contract in C# and implemented it in PHP. A new option “singlewsdl” in WCF 4.5 helped me a lot. Using this option I generated the service description as a single WSDL-file without additional XSD-files containing the data contracts of the service. Then I uploaded this WSDL-file on my Web Server and written PHP code for all the methods of the service.
While investigating how to create a Web Service in PHP I run into NuSoap library, that can generate WSDL based on some matadata describing Web Service method signatures and the data structures. I downloaded NuSoap library and found some trivial sample that started working after adding the highlighted line of code: