Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $app->post('/users/create/:data', function ($data) use($app)
- {
- $app->response->status(201);
- echo "The user ".$data['name']." was added successfully";
- }
- );
- $data = array(
- 'id' => 3,
- 'name' => 'Gree3a'
- );
- $url = "http://localhost/api/users/create/";
- $ic = curl_init();
- //set options
- curl_setopt($ic, CURLOPT_URL, $url);
- curl_setopt($ic, CURLOPT_POST, true);
- curl_setopt($ic, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ic, CURLOPT_RETURNTRANSFER, true);
- //perform our request
- $result = curl_exec($ic);
- curl_close($ic);
- echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement