rest - How do I pass value via URL to thia PHP code. -
<?php require_once ("resthandler.php"); $param=""; if(isset($_get["param"])) { $param = $_get["param"]; } //var_dump($param); if(strpos($param,'studentlogin')!==false) // handling student login requests { $param = explode("-",$param); $param = explode(",",$param[1]); $stuid = explode("=",$param[0]); $stuid = $stuid[1]; $pass = explode("=",$param[1]); $pass = $pass[1]; $resthandler = new resthandler(); $resthandler->checkstudentlogin($stuid,$pass); } else if(strpos($param,'teacherslist')!==false) { $resthandler = new resthandler(); $resthandler->getteacherslist(); } else if(strpos($param,'questionslist')!==false) { $resthandler = new resthandler(); $resthandler->getquestionslist(); } ?>
this url vale.
if call works properly. http://localhost/xampp/api/index.php?param=questionslist
response in json
[{"questionid":"1","statement":"how you?"},{"questionid":"2","statement":"what name?"}]
however log in (studentlogin) can't figure out how pass value.
to pass array in url this
http://localhost/path/index.php?param[]=param1¶m[]=param2¶m[key]=param3&name=name
etc.
Comments
Post a Comment