🚧 Démarre le développement suite au passage à React

This commit is contained in:
Shikiryu
2018-06-29 00:04:32 +02:00
parent 7cada3dd07
commit 3a5008cc95
6 changed files with 127 additions and 29 deletions

View File

@@ -2,7 +2,7 @@
namespace Shikiryu\LBCReposter;
use Goutte\Client;
use GuzzleHttp\Client;
class Account
{
@@ -20,22 +20,19 @@ class Account
*/
public function __construct(Config $config)
{
$this->client = new \Goutte\Client();
$this->client->setClient(
new \GuzzleHttp\Client([
'timeout' => 90,
'verify' => false,
'curl' => [
CURLOPT_TIMEOUT => 60,
CURLOPT_TIMEOUT_MS => 60,
CURLOPT_CONNECTTIMEOUT => 60,
],
'headers' => [
'User-Agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0',
],
])
);
$this->client->setMaxRedirects(10);
$this->client = new Client([
'timeout' => 90,
'verify' => false,
'curl' => [
CURLOPT_TIMEOUT => 60,
CURLOPT_TIMEOUT_MS => 60,
CURLOPT_CONNECTTIMEOUT => 60,
CURLOPT_COOKIEJAR => tmpfile(),
],
'headers' => [
'User-Agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0',
],
]);
$this->config = $config;
}
@@ -64,8 +61,8 @@ class Account
public function isConnected()
{
if (!$this->is_connected) {
$crawler = $this->client->request('GET', Actions::HOME_URL);
$this->is_connected = $crawler->filter('#account_logout')->count() == 1;
// $crawler = $this->client->request('GET', Actions::HOME_URL);
// $this->is_connected = $crawler->filter('#account_logout')->count() == 1;
}
return $this->is_connected;
}