Pages

Saturday, 17 June 2023

Get Rest API | Core PHP

This post will help you to make get API to return records using core PHP  in JSON format.

Return A single record

<?php

header("Content-Type:application/json");

$response['roll'] = 101;
$response['name'] = "ram";
$response['city'] = "vns";
$json_response = json_encode($response);
echo $json_response;

?>

Next Example

No comments:

Post a Comment