<?php
require __DIR__ . '/../src/ShopifyClient.php';

$tokens = file(__DIR__ . '/../logs/token.txt', FILE_IGNORE_NEW_LINES);
if (!$tokens) {
	// Token bulunamadı. Önce install.php üzerinden app’i yükleyin.
	die("No tokens found. Please install the app via install.php first.");
}

list($shop, $accessToken) = explode('|', $tokens[0]);

$client = new ShopifyClient($shop, $accessToken);
$products = $client->getProducts();

echo "<h1>PRODUCTS AtakanAu</h1>";
foreach ($products['products'] as $product) {
	echo "<p>{$product['title']}</p>";
}
