Apero fixes
This commit is contained in:
parent
6a3c912940
commit
41be2895b2
15
Source.php
15
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Reference in a new issue