Click here to Skip to main content
14,869,378 members
Please Sign up or sign in to vote.
1.21/5 (4 votes)
See more:
Hai,
I am very new to the REST API concepts in PHP domain and I am in a situation to use it.
Can any one please help me by explaining this concept.

Differentiate the REST API with the normal GET and POST method in php.

And also please give me a simple example in php using REST API for displaying the name and age of a person, that is, for example I have the coding to display name and age when the user clicks the submit button using post method.

I need the same example using REST API.

XML
<?php
  if( $_POST["name"] || $_POST["age"] )
  {
     echo "Welcome ". $_POST['name']. "<br />";
     echo "You are ". $_POST['age']. " years old.";
     exit();
  }
?>
<html>
<body>
  <form action="<?php $_PHP_SELF ?>" method="POST">

  Name: <input type="text" name="name" />
  Age: <input type="text" name="age" />

  <input type="submit" />
  </form>
</body>
</html>


Thanks in Advance!!!
Please give me a solution!^
Posted
Updated 24-Sep-14 19:52pm
v2

1 solution

   
v5
Comments
sai sruthi 25-Sep-14 7:28am
   
thanks for the above link but I am expecting a very simple example for understanding how REST works the coding given in that site is somewhat a difficult one since I am a beginner.
ChauhanAjay 25-Sep-14 7:44am
   
Sorry for the first link. there is another link I have added kindly check and hope it helps.
sai sruthi 26-Sep-14 2:40am
   
Hai Chauhan, and that's really a great help and 1000s of thanks for you!!!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900