WDDX PHP

The Web Distributed Data Exchange, or WDDX, is an XML language for describing data in a way that facilitates moving it from one programming environment to another. The intent is to relieve difficulty associated with sending data between applications that represent data differently. Traditionally this has been done by designing special interfaces for each case. For instance, you may decide that your PERL script will write out its three return data separated with tabs, using a regular expression to extract the text you later convert to integers. WDDX intends to unify the effort into a single interface.

In order to use the functions in this section, you need only use --with-wddx when configuring PHP prior to compilation. At the time of this writing WDDX support wasn't compiled into the Windows binaries.

Andrei Zmievski added WDDX support to PHP.

wddx_add_vars(integer packet_identifier, string variable, ...)
The wddx_add_vars function is one of three functions for creating packets incrementally. After creating a packet with wddx_packet_start, you may add as many variables as you wish with wddx_add_vars. After the packet_identifier argument, you may pass strings with the names of variables in the local scope or arrays of strings. If necessary, PHP will explore multidimensional arrays for names of variables. The variables will be added to the packet until you use wddx_packet_end to create the actual packet as a string. See wddx_packet_start, below, for an example of use.

value wddx_deserialize(string packet)
The wddx_deserialize function returns a variable representing the data contained in a WDDX packet. If the packet contains a single value, it will be returned as an appropriate type. If the packet contains multiple values in a structure, an associative array will be returned.

string wddx_packet_end(integer packet_identifier)
The wddx_packet_end function returns a string for the packet created with wddx_packet_start and wddx_add_vars. See wddx_packet_start, below, for an example of use.

integer wddx_packet_start(string comment)
The wddx_packet_start function returns an identifier to a WDDX packet you can build as you go. The optional comment argument will be placed in the packet if supplied. Use the returned packet identifier with wddx_add_vars and wddx_packet_end.

string wddx_serialize_value(value data, string comment)
The wddx_serialize_value function creates a WDDX packet containing a single value. The data will be encoded with no name. The optional comment field will be added to the packet as well.

string wddx_serialize_vars(string variable, ...)
Use wddx_serialize_vars to create a packet containing many variables. You may specify any number of variable names in the local scope. Each argument may be a string or an array. PHP will recursively explore multidimensional arrays for more names of variables if necessary.

A WDDX packet is returned.<.p>


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

PHP Topics