Fork me on GitHub

Data Formats & Types



XML

Well Formed

Valid


Parsing XML

DOM

SimpleXML


SimpleXml


DOM

1
2
3
4
5
6
7
8
9
10
<?php
$dom = new DomDocument();
$dom->load("library.xml");
$dom->loadXML($xml);

DomDocument::loadHtmlFile(); // and DomDocument::loadHTML()
DomDocument::save(); // (to a file)
DomDocument::saveXML(); // (to a string)
DomDocument::saveHTML(); // (also to a string, but saves an HTML document instead of an XML file)
DomDocument:saveHTMLFile(); // (to a file in HTML format).

DomNode

Removing

Import


XPath


XPath Searches


Web Services


REST


SOAP

The functions (generally) take a WSDL file as input, and create an object that mimics the services of the webservice:

1
2
<?php
$client = new SoapClient("http://soap.amazon.com/schemas2/AmazonWebServices.wsdl");

API call:

1
2
<?php
$result = $client->KeywordSearchRequest($params);

Debugging

1
2
3
4
<?php
$client = new SoapClient('http://api.google.com/GoogleSearch.wsdl', array('trace' => 1));
$client->__getLastRequestHeaders();
$client->__getLastRequest();

PHP5 SOAP Server

1
2
3
4
5
<?php
$options = array('uri' => 'http://example.org/soap/server/');
$server = new SoapServer(NULL, $options);
$server->setClass('MySoapServer');
$server->handle();

DateTime

http://php.net/manual/en/class.datetime.php http://php.net/manual/en/book.datetime.php


JSON & AJAX

http://php.net/manual/en/book.json.php

blog comments powered by Disqus