Browse Source

🚑 Corrige le fichier exemple

api
Clement Desmidt 4 years ago
parent
commit
26911d0f8d
  1. 18
      lbcreposter.php

18
lbcreposter.php

@ -4,20 +4,24 @@ include 'vendor/autoload.php';
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);
$script_params = parse_ini_file(sprintf('%s/lbcreposter.ini', DEALS_DIR), true);
$config = new \Shikiryu\LBCReposter\Config($script_params);
$account = new \Shikiryu\LBCReposter\Account($client, $config);
$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR));
$account = new \Shikiryu\LBCReposter\Account($config);
$actions = new \Shikiryu\LBCReposter\Actions($account);
//$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR));
if ($account->connect()) {
if ($actions->connect()) {
// existing deals
$deals = $account->getDeals();
$deals = $actions->retrieve();
/** @var \Shikiryu\LBCReposter\Deal $deal */
foreach ($deals as $deal) {
foreach ($deals as $i => $deal) {
$deal->save(DEALS_DIR);
}
$account->addDeal($deal);
// $account->addDeal($deal);
var_dump($deals);
} else {
echo 'not connected';
}
Loading…
Cancel
Save