My Client is using a very old version of SLIM. Hes has copied the SLIM code over to another Server and it doesn’t work and I can’t see why. The echo $body in this function is returning the 404 page
The page is
public function run()
{
print_r($this->middleware[0]);
set_error_handler(array(’\Slim\Slim’, ‘handleErrors’));
//Apply final outer middleware layers
if ($this->config('debug')) {
//Apply pretty exceptions only in debug to avoid accidental information leakage in production
$this->add(new \Slim\Middleware\PrettyExceptions());
}
//Invoke middleware and application stack
$this->middleware[0]->call();
//Fetch status, header, and body
list($status, $headers, $body) = $this->response->finalize();
print_r($this->response->finalize());
// Serialize cookies (with optional encryption)
\Slim\Http\Util::serializeCookies($headers, $this->response->cookies, $this->settings);
//Send headers
if (headers_sent() === false) {
//Send status
if (strpos(PHP_SAPI, 'cgi') === 0) {
header(sprintf('Status: %s', \Slim\Http\Response::getMessageForCode($status)));
} else {
header(sprintf('HTTP/%s %s', $this->config('http.version'), \Slim\Http\Response::getMessageForCode($status)));
}
//Send headers
foreach ($headers as $name => $value) {
$hValues = explode("\n", $value);
foreach ($hValues as $hVal) {
header("$name: $hVal", false);
}
}
}
//Send body, but only if it isn't a HEAD request
if (!$this->request->isHead()) {
echo $body;
}
$this->applyHook('slim.after');
restore_error_handler();
}
It should be going to
$app->post(’/validate_api’, function() use ($app) {
}
in index.php
Is there something we have missed? The version is 2.6.1
Thanks