diff --git a/Source.php b/Source.php index 2476c9f..6b47d01 100644 --- a/Source.php +++ b/Source.php @@ -83,13 +83,20 @@ abstract class Source { * * @return string */ - public function get_text($url) { + public function get_text($url, $post = []) { $client = new GuzzleClient([ 'timeout' => 30, ]); - $response = $client->request('GET', $url, [ - 'cookies' => $this->cookies, - ]); + if ($post === []) { + $response = $client->request('GET', $url, [ + 'cookies' => $this->cookies, + ]); + } else { + $response = $client->request('POST', $url, [ + 'form_params' => $post, + 'cookies' => $this->cookies, + ]); + } return (string) $response->getBody(); } diff --git a/Source/Apero.php b/Source/Apero.php index 3b50dcc..beaa710 100644 --- a/Source/Apero.php +++ b/Source/Apero.php @@ -27,11 +27,15 @@ use \Game; class Apero extends Source { public $title = "Apero"; protected function parse() { - $text = $this->get_text('http://apero.ru/Текстовые-игры/Песочница'); + $text = $this->get_text('http://apero.ru/Текстовые-игры/Песочница', [ + 'order_by' => 'by_public', + ]); $text = mb_convert_encoding($text, 'UTF-8', 'auto'); $this->loadStr($text); $this->parseIndex(); - $text = $this->get_text('http://apero.ru/Текстовые-игры'); + $text = $this->get_text('http://apero.ru/Текстовые-игры', [ + 'order_by' => 'by_public', + ]); $text = mb_convert_encoding($text, 'UTF-8', 'auto'); $this->loadStr($text); $this->parseIndex();