Page MenuHomeGitPull.it

Answers.php
No OneTemporary

Authored By
Unknown
Size
771 B
Referenced Files
None
Subscribers
None

Answers.php

<?php
namespace Wikicaptcha\Backend;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Diactoros\Response\JsonResponse;
class Answers implements RequestHandlerInterface {
public function handle(ServerRequestInterface $request): ResponseInterface {
$payload = $request->getAttribute('ParsedBody', []);
$questions = WikiApiDto::fromArray($payload);
// TODO: check that user is a human or a bot
//return new JsonResponse($questions);
// A real system would probably not give this information to the user, but to the server
if((bool) mt_rand(0, 1)) {
return new JsonResponse(['human' => true]);
} else {
return new JsonResponse(['human' => false]);
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Nov 19, 04:25 (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264728
Default Alt Text
Answers.php (771 B)

Event Timeline