Вы находитесь на странице: 1из 3

XML: well formed and vlid Standard XML PHP Extensions: XMLReader and XMLWriter SimpleXML: Php extension

sion OOP: Elements object properties Atributes associative arrays $xml = simplexml_load_string $xml = simplexml_load_file $xml = new SimpleXMLElement() with either file or string $xml->asXML(); To save a document: file_put_contents('output.xml',$xml->asXML()) XML and XPATH: method: xpath() , return arrays with results Mirar sintaxis de xpath: '/' root '//' anywhere from root * anything @ attribute if expresion is wrong no results DOM: requires libxml extension, requires expat library uses utf-8 encoding $dom->loadXML($xml); (a string) $dom->saveXML(); (to string) $dom->getElementByTagName('tagname'); Not possible to use xpath querys on dom SimpleXML and DOM: simplexml_import_dom dom_import_simplexml Constants: XML_ELEMENT_NODE : define node as DOMELEMENT XML_TEXT_NODE : define node as DOMTEXT Webservices: Described by WSDL SOAP: former Simple Object Acces Protocol, now SOAP 1.2 under W3C requires LIBXML extension soap functions: is_soap_fault : if soap call has failed use_soap_error_handler: indicates wether to use an error handler soap configurations at php.ini soap.* HTTP only for transport REST: Representational State Transfer Design standartd:

Only HTTP Stateless Exposes URI, build in HTTP Transfers XML, JSON or both Suports data types Uses HTTP verbs: GET, POST, PUT, DELETE Request headers: Content-type : what is being provided Accept: what to expect in response Response headers: Content-type: what being returned Accept: what and when to cache Status codes: 1XX Informational 2XX Success 3XX Redirection 4XX Bad request 5XX Error Context Switching: Analyzes http request header / Request URI and responses with appropriate output Example: ouput for XMLHttpRequest or AcceptHTTP headers WSDL: information about: where which methods data types return values etc... Create webservice: Server: $soap = new SoapServer('file.wsdl'); $soap->setClass('ClassName'); Client: $soap = new SoapClient('file.wsdl'); $soap->myMethod('params'); or $soap->__soapCall('myMethod',$params); Debugging: __getLastRequest() __getLastRequestHeaders() __getLastResponse() __getLastResponseHeaders() Exception: SoapFault is_soap_fault($result) JSON: Javascript Object Notation Pre defined constants: JSON_ERROR_NONE: confirm wether error ocurred or not

JSON_ERROR_SYNTAX: Indicates syntax error JSON_ERROR_UTF8: aids in detecting encoding issues Functions json_decode($json,$assoc=false,$depth) json_encode($value,$options), $value, anything but a resource json_last_error $options (BITMASK): (php 5.3) JSON_HEX_QUOT JSON_HEX_TAG JSON_HEX_AMP JSON_HEX_APOS JSON_FORCE_OBJECT Date Time: REtrive date and time from server 64 bit storage reflect locale on server, and special date adjusments Runtime configuration: date.* Constants: DateTime::cookie; DateTime::rss; Methods __construct(string $time = now, [DateTimeZone $timezone = NULL]) DateTime add(DateInterval $interval) DateTime setDate($year,$month,$day); DateTime setTime(... others: date_default_timezone_set('America/Los_Angeles'); Static Methods: DateTime::add(DateInterval $interval) DateTime::__construct(... DateTime::createFromFormat($format, $time, [$timezone]) DateTime::format(string $format);

Вам также может понравиться