pens_client_test.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * This file is part of php-pens.
  4. *
  5. * php-pens is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * php-pens is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with php-pens. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * Provides a test implementation of a PENS Client.
  20. *
  21. * @author Guillaume Viguier-Just <guillaume@viguierjust.com>
  22. * @licence http://www.gnu.org/licenses/gpl.txt
  23. */
  24. require_once __DIR__ . '/pens.php';
  25. class MyRequestHandler extends PENSRequestHandler {
  26. public function processRequest($request, $response) {
  27. // Do the processing of the alert or the receipt here
  28. }
  29. }
  30. $handler = new MyRequestHandler();
  31. $client = PENSClient::singleton();
  32. $client->setRequestHandler($handler);
  33. $client->receiveRequest();