A system for creating a URL based API to a dataset?

I would like to create a web service where by I allow users to query a dataset (hosted on some server) through a URL.

A user would use a URL like:


In order to get the data.

What is the simplest (free, open-source) system to setup for creating such a service? (PHP+MySQL is probably preferred)




$year_start = $_GET['yearstart'];
$year_end = $_GET['yearend'];
$data_type = $_GET['datatype'];
$topic = "" $_GET['topic'];

here fetch return value from db, file system, intergalatic source, divine logic..
$return = "fetched from above";

echo json_encode($return);

NOTE: remember to escape all data that you get from the URL/any other source of user input before acting on it

UPDATE: Basically what you will need to do is something like:

  • Fetch all the parameters required by your web service (In your case it will come through the URL)
  • Sanitize/Validate the parameters (If there are errors, show it immediately and terminate)
  • Once you are sure all the data passed to the service is good, act upon it (Usually this means some DB queries/calculations etc)
  • After the action step is done, prepare the data in a format that is understandable to the web service client (For starters, I would assume just XML or JSON, later on you could try advanced protocols like SOAP - remember SOAP is just XML, in a standard that supports the SOAP protocol, that's all)
  • I have added a link below which shows a simple example of generating XML/JSON as a web service response (It is difficult to explain the whole thing in this answer)
  • Once you have the response ready, echo it out to the web service client.

Check out this link which shows a basic and easy example of creating a simple web service using PHP/MySQL:


Need Your Help

Revert Git repo to a previous commit

git git-reset git-revert

How do I revert from my current state to a snapshot made on a certain commit?

How to Consume an RPC-Style Web Service with a WCF Service Reference?

c# wcf soap rpc soap-rpc-encoded

I am writing a C# client that calls a web service to authenticate clients. I used add service reference to add the wsdl file to my project and the proxy class generated successfully.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.