Thin PHP Framework causing "Inability to open page"

I installed the REST API using the Slim PHP platform, which works great when using ie requests http://mysite.com/class/id .

But when I go to http://mysite.com/ , I get the following error in Safari:

Safari cannot open the "http://mysite.com/" page.

Error: "Unable to decode raw data" (NSURLErrorDomain: -1015)

Choose Safari> Report Apple Errors, mark the error number, and describe what you did before you saw this message.

Please tell me where am I wrong?

include_once('config.php'); require 'Slim/Slim.php'; $app = new Slim(); $app->post('/user/create', 'create_user'); $app->get('/user/:id', 'info_user'); $app->post('/user/:id', 'update_user'); $app->delete('/user/:id', 'delete_user'); $app->post('/user/validate', 'validate_user'); $app->get('/user/:id/venues', 'venues_user'); $app->get('/user/:id/queues', 'queues_user'); $app->post('/venue', 'create_venue'); $app->post('/venue/:id', 'update_venue'); $app->delete('/venue/:id', 'delete_venue'); $app->get('/venue/:id', 'info_venue'); $app->get('/venue/:id/queues', 'queues_venue'); $app->post('/queue', 'create_queue'); $app->post('/queue/:id', 'update_queue'); $app->delete('/queue/:id', 'delete_queue'); $app->get('/queue/:id', 'info_queue'); $app->run(); 
+4
source share
2 answers

When using PHPFog and Slim, you need to install HTTP version 1.0, not 1.1.

You can do this by adding a parameter to the variable:

 $app = new Slim(array('http.version' => '1.0')); 

This was decided thanks to the help of the creator of Slim framework!

Hope this helps someone else!

+5
source

Perhaps you need a record, for example:

$app->get('/', 'index_page');

0
source

Source: https://habr.com/ru/post/1380677/


All Articles