POST request to REST API implemented in PHP -


i integrating new front-end survey application using angularjs old restful back-end application running on php/mysql.

currently require users sign in order complete survey. allow guest users, i.e. not signed up, complete survey. best way bypass using auth token (or generate new one) guest user in php? post request make guest, no other requests needed.

i new php. below how creating survey:

  public function createnew(application $app, request $request, $now = false) {     $data = $request->request->all();     $token = (isset($data['token']) ? $data['token'] : $app['token']);     $survey = new survey($token, 'token');     $error = new jsonresponse(array('status' => 400, 'message' => "error while completing survey"));     $success = new jsonresponse(array('status' => 200, 'message' => 'survey completed.'));  ... } 

basically, token required , returns error if not provided. thank , suggestions.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -