execute( HttpRequest::factory('https://jsonplaceholder.typicode.com/todos/1') ); $todo = $response->isSuccess() ? $response->json() : []; return $this->render('index', ['todo' => $todo]); } public function postAction(): string { // POST с JSON-телом $response = (new Curl())->execute( HttpRequest::factory('https://jsonplaceholder.typicode.com/posts') ->method('POST') ->json(['title' => 'Bicycle', 'body' => 'test', 'userId' => 1]) ); $created = $response->isSuccess() ? $response->json() : []; return $this->render('index', ['created' => $created]); } }