PHP code example of arslaniftikhar / shopify-client
1. Go to this page and download the library: Download arslaniftikhar/shopify-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
session_start();
$shopify = new Shopify($_GET['shop'], $APP_API_KEY, $APP_SECRET);
if ($token = $client->getAccessToken()) {
// You can save the access token to database to make the api call in future.
$_SESSION['shopify_access_token'] = $token;
$_SESSION['shopify_shop_domain'] = $_GET['shop'];
// Redirect to app's dashboard URL
header("Location: dashboard.php");
}
else {
die('Couldn't find the access token');
}
session_start();
$shopify = new Shopify(, $APP_API_KEY, $APP_SECRET);
$shopify->setAccessToken($_SESSION['shopify_access_token']);
// you can get the resource by just passing the resource name.
$products = $shopify->get('products');
$shopify = new Shopify($SHOPIFY_SHOP_DOMAIN, $SHOPIFY_API_KEY, $SHOPIFY_SHARED_SECRET);
$result = $shopify->get('shop');