maksudc / REST-Webservice-PHP

A sample web service script written in php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple REST-ful Web Service Script

Since REST is all about sending request to a server . Each request has to things request format(GET,POST,PUT,DELETE) and request link (url of service).

REST provides a clean , human readable interface .

One can easily understand the purpose of a webservice by simply looking at the url & request pattern.

BASIC REST Description

returns all the items in database.

Response: {["id":"",...],[...],[..]}

returns 3rd item in database

Response: {"id":3,"name":"dsf"}

Would create a new Item into database

Response: {"status":"successful"}

Would update an Item into database

Response: {"status":"successful"}

Would delete an Item from database

Response: {"status":"successful"}

Example

curl command: curl -X POST http://localhost.com/post.php -d name=Myname -d address=MyAddress -d email=MyEmail

Response: {"status":"successful"} or {"status":"failure"}

Response: {"status":"successful"} or {"status":"failure"}

Response: {"status":"successful"} or {"status":"failure"}

Contributor

  • Md. Maksud Alam Chowdhury mc65799@gmail.com
  • Department of Computer Science & Engineering
  • Bangladesh University of Engineering & Technology

About

A sample web service script written in php


Languages

Language:PHP 100.0%