daryast

Untitled

Apr 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Class DefaultController
  5. */
  6. class DefaultController extends Controller
  7. {
  8. protected $testResponse;
  9. public $request;
  10. public $method;
  11. public $exturl;
  12. public $rules = array(
  13. array("allow",
  14. 'users' => array("*")
  15. )
  16. );
  17.  
  18. public function actionIndex()
  19. {
  20. $this->render('index');
  21. }
  22.  
  23. public function actionTest($exturl = '')
  24. {
  25. header('Content-type: text/html;charset=utf8');
  26.  
  27.  
  28. $url = Yii::app()->params['service'] . $exturl;
  29.  
  30. $this->testResponse = new ExternalService($url);
  31.  
  32. $method = Yii::app()->request->getRequestType();;
  33.  
  34. $request = Yii::app()->request->getRawBody();
  35.  
  36. $response = $this->testResponse->getResponse($method, $request);
  37.  
  38. echo($response);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment