Đang chuẩn bị liên kết để tải về tài liệu:
PHP Programming with PEARXML, Data, Dates, Web Services, and Web APIs - Part 7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Đối với ví dụ này, chúng tôi đã sử dụng phương pháp package.search () được cung cấp bởi các dịch vụ trang web PEAR. Phương pháp này trả về một mảng kết hợp mà chúng ta có thể dễ dàng lặp bằng cách sử dụng một vòng lặp foreach đơn giản (), nếu các dữ liệu đã được phân phối bởi bất kỳ nguồn địa phương. Chạy kịch bản này sẽ ra: | Chapter 4 echo Could not use the XML-RPC service. n echo response- faultString exit value response- value packages XML_RPC_decode value foreach packages as packageName packageInfo echo h1 packageName h1 n echo p packageInfo summary p n For this example we have used the package.search method provided by the PEAR website service. This method returns an associative array over which we can easily iterate using a simple foreach loop as if the data had been delivered by any local source. Running this script will output XML_Beautifier Class to format XML documents. XML_CSSML The PEAR XML_CSSML package provides methods for creating cascading style sheets CSS from an XML standard called CSSML. XML_FastCreate Fast creation of valid XML with DTD control. XML_fo2pdf Converts a xsl-fo file to pdf ps pcl text etc with the help of apache-fop XML_HTMLSax A SAX parser for HTML and other badly formed XML documents XML_image2svg Image to SVG conversion XML_NITF Parse NITF documents. XML_Parser XML parsing class based on PHP s bundled expat XML_RPC PHP implementation of the XML-RPC protocol XML_RSS RSS parser XML_SVG XML_SVG API XML_Transformer XML Transformations in PHP XML_Tree Represent XML data in a tree structure XML_Util XML utility class. XML_Wddx Wddx pretty serializer and deserializer Of course the result might differ as the packages provided by PEAR change frequently. This is what s really great about using web services you always get the most current data. 169 Web Services Accessing the Google API Google is one of the most popular sites to offer its functionality as a web service and while the API is still labelled beta it still is one of the most commonly used web services. You can learn more about the Google web service on its website at http www.google.com apis . In order to access the Google API you will need to create a Google account. With this registration you will receive a Google API key that you will have to supply with every request you send to the web service. .