Posted inAll

Sample REST webservice file in php

Create simple PHP file. For Example: service.php.

Steps:

1) Assign your data in an array and encode it with json.
2) Add the conditions for authentication.
3) Choose the proper HTTP method.
4) Access the website data using curl.

Filename: service.php

<?php
$row = array("Firstname"=>"Testing", "Lastname"=>"User", "Email"=>"user@domain.com");
echo json_encode($row);
?>

Leave a Reply