} public function sendGetById($id) { $ch = curl_init("http://localhost/slimrest/books/{$id}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); $response = curl_exec($ch); curl_close($ch); if (!$response) { return false; } else { var_dump($response); } } public function sendDelete($id) { $ch = curl_init("http://localhost/slimrest/books/{$id}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); $response = curl_exec($ch); curl_close($ch); if (!$response) { return false; } else { var_dump($response); } } } $curl = new Consumer(); $curl->sendDelete(2);