API/lbcreposter.php
Clement Desmidt 2750443612 🚚 Déplace dans Account
2017-09-29 16:01:01 +02:00

24 lines
713 B
PHP

<?php
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);
$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));
if ($account->connect()) {
// existing deals
$deals = $account->getDeals();
/** @var \Shikiryu\LBCReposter\Deal $deal */
foreach ($deals as $deal) {
$deal->save(DEALS_DIR);
}
$account->addDeal($deal);
var_dump($deals);
}