2016-08-21 22:54:00 +02:00
|
|
|
<?php
|
|
|
|
include 'vendor/autoload.php';
|
|
|
|
include 'library/Account.php';
|
|
|
|
|
|
|
|
$client = new \Goutte\Client();
|
|
|
|
$client->setClient(
|
|
|
|
new \GuzzleHttp\Client([
|
|
|
|
'timeout' => 90,
|
|
|
|
'verify' => false,
|
|
|
|
])
|
|
|
|
);
|
|
|
|
|
2016-08-24 22:30:13 +02:00
|
|
|
define('APP_DIR', dirname(__FILE__));
|
|
|
|
define('DEALS_DIR', sprintf('%s/deals', APP_DIR));
|
|
|
|
|
|
|
|
$script_params = parse_ini_file(sprintf('%s/lbcreposter.ini.dev', DEALS_DIR), true);
|
|
|
|
$credentials = $script_params['CREDENTIALS'];
|
|
|
|
$login = $credentials['login'];
|
|
|
|
$password = $credentials['password'];
|
2016-08-21 22:54:00 +02:00
|
|
|
|
|
|
|
$account = new \Shikiryu\LBCReposter\Account($client, $login, $password);
|
|
|
|
if ($account->connect()) {
|
|
|
|
// existing deals
|
|
|
|
$deals = $account->getDeals();
|
2016-08-24 22:30:13 +02:00
|
|
|
/** @var \Shikiryu\LBCReposter\Deal $deal */
|
|
|
|
foreach ($deals as $deal) {
|
|
|
|
$deal->save(DEALS_DIR);
|
|
|
|
}
|
2016-08-21 22:54:00 +02:00
|
|
|
var_dump($deals);
|
|
|
|
}
|