You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lbcreposter.php 809B

123456789101112131415161718192021222324252627
  1. <?php
  2. include 'vendor/autoload.php';
  3. define('APP_DIR', dirname(__FILE__));
  4. define('DEALS_DIR', sprintf('%s/deals', APP_DIR));
  5. $script_params = parse_ini_file(sprintf('%s/lbcreposter.ini', DEALS_DIR), true);
  6. $config = new \Shikiryu\LBCReposter\Config($script_params);
  7. $account = new \Shikiryu\LBCReposter\Account($config);
  8. $actions = new \Shikiryu\LBCReposter\Actions($account);
  9. //$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR));
  10. if ($actions->connect()) {
  11. // existing deals
  12. $deals = $actions->retrieve();
  13. /** @var \Shikiryu\LBCReposter\Deal $deal */
  14. foreach ($deals as $i => $deal) {
  15. $deal->save(DEALS_DIR);
  16. }
  17. // $account->addDeal($deal);
  18. var_dump($deals);
  19. } else {
  20. echo 'not connected';
  21. }