2

I'm going to create a Restful web service API using PHP. I've googled and found how to create a rest client, but I want to know how to create rest server instead.

I already have a MySQL database to retrieve the data but I don't know how to output my results in XML format.

danielrvt
  • 10,177
  • 20
  • 80
  • 121
tgt
  • 51
  • 1
  • 4
  • So your question is just with writing an XML file? If you're not dependent on XML you may also simply use JSON, which requires only one call to `json_encode`. – deceze Jul 04 '11 at 07:26
  • Unless you specifically need XML, I would recommend using JSON as an output format, because it's much easier to deal with on the client side. – Ikke Jul 04 '11 at 07:26
  • the XML output, i will use in android device too. can json be used on android device? if it can, how can i create that? please give me some advice:) – tgt Jul 04 '11 at 07:53
  • possible duplicate of [how to generate xml file dynamically using PHP?](http://stackoverflow.com/questions/486757/how-to-generate-xml-file-dynamically-using-php) – cweiske Jul 04 '11 at 11:47

3 Answers3

1

You can take a look at PHP-CRUD-API, which is an extensible PHP script that I wrote that does exactly what you want: provide a REST API based on a MySQL Database.

mevdschee
  • 1,625
  • 19
  • 16
0

Take a look at RockWall engine. The main feature of RockWall is multiple REST requests by single HTTP request.

RockWall REST engine site

w3core
  • 129
  • 3
0

Take a look at a framework like FRAPI that helps you build REST services with minimum effort.

Jay Sidri
  • 6,271
  • 3
  • 43
  • 62