Samples and Examples - PDF and ZIP file downloads

Use the Contact form and make an enquiry.

Regarding material on this page, enquire for:

For students, teachers, engineers and ego-free programmers.

Web Services using REST

Apr 2016

REST Server and Clients



1. Web Service using Zend Rest Client and Server
This is demo web service to provide some unit conversions as an example of utilizing Zend Rest, available in Zend Framework 1.12.17. One way of working adopted here is upload of Zend Framework complete to root dir on server. Then, in the web service folder, to have php.ini file with statement to set include_path. For 1and1 shared hosting, include_path would be set to such as:
include_path = ".:/homepages/8/d513739477/htdocs/ZendFramework-1.12.17/ZendFramework-1.12.17/library"
This is the web server path to the zend framework library folder that contains the Zend folder.
In the web service folder, server file is UnitsServer.php that requires Zend/Rest/Server.php and client file is UnitsConv.php that requires Zend/Rest/Client.php.
Reference - RESTful PHP Web Services, Samisa Abeysinghe (download PDF above).
The units_conv server responds to GET requests by returning comma separated results like different physical quantities returned as 'Length,Area,Mass...' (Or could return name=value pairs like a=1.0,b=2.0...).
Typical web request to units_conv server is 'http://awebserver/unitsserver.php?method=MeasurementUnits&Quantity=PhysicalQuantity' so as to get list of available units for given physical quantity, like length units 'foot,inch,metre...'
Conversion factors for units of measurement - Demo Zend Rest Client. Drop-down lists of physical quantities and corresponding units of measurement are got from the web service. Select unit of measurement from drop-down list, select value and get e.g.,
3 foot = 1 yard etc.


2. Web Service Desktop Client
Delphi Win32 REST Client

Delphi (Win32) app - Delphi project files and  executable, UnitsConvRESTClient.exe, zip file download here. This desktop app gets the interchangeable unit conversions from UnitsServer.php. In the zip file, program notes explain how the app, for development purpose, is addressed to http://localhost/UnitsServer.php, and how this addressing can be changed for further test/dev or production purposes. In Delphi, the app acts as HTTP client by using non-visual Indy sockets component, TIdHTTP, and the app uses the non-visual component TXMLDocument to accept the XML GET query. To parse the XML (to obtain units conversion comma separated results), Delphi code is taken from the Marco Cantù Delphi REST Clients Collection - Section 01: RssClient; there is a sleep() call (variable in GetNodeVal() function) to (in the words of Marco Cantù) avoid getting too fast of a rate (which will block the service).

3. Commercial Web Services PHP Clients

Many commercial Web Services using the REST protocol - Web Services Directory at To access these services directly, sample URL's with query strings together with typical response XML or CSV should be given. Then PHP Client can readily be written to provide web app UI for the web service.

' is the world's largest and most comprehensive directory and search engine for acronyms, abbreviations and initialisms on the Internet. holds hundreds of thousands of entries organized by a large variety of categories from computing and the Web to governmental, medicine and business and it is expanding daily.' provides a good number of Web Services:

Above web app, Definitions from, is prototype Web Services client, communicating with that accepts GET requests made simply using a URL and query string such as (this example taken from, denoting a request to 'abbreviations' for definitions of 'asap').
Client programs, with user interface, have to take user inputs, build and transmit the query URL's accordingly, then respond to and display the information returned.  For Abbreviations, Conversions, ZIP Codes, Synonyms, Definitions, Phrases, Rhymes and Quotes: API web pages are provided by In their words: 'Each one of these pages gives the programmer an immediate and fully comprehensible reference, citing the request URL and parameters, sample request URL, Response elements, and Sample Response, a snippet of XML that has to be parsed (interpreted) by the client program to drill down to detailed results required'.


Defintions from - PHP programming is available here, Zip file, including program notes. In the Zip file, two versions of this Delphi for PHP web app, one using Xajax, making ajax requests to Should be good (or useful, with or without D4PHP) for many different RESTful web services clients.


Powered by World Weather Online



World Weather Online, accurate and reliable weather forecasts - Free 60-day trial using API Key - Local Weather REST API enables return of weather data in response to requests as shown in the API Explorer.
Above client program works by sending Request URL assembled from user inputs so as to get CSV output as returned in legacy API Request Builder with sample entries and Format CSV selected. This web app uses the Delphi for PHP VCL (Visual Component Library) - all souce code (and program notes) available for download here. With or without Delphi, the one PHP file, worldweather.php (in download) should be useful in discovering a method of accessing World Weather Online.