예제 #1
0
 protected function setUp()
 {
     Shopify::setup('9ba1eeb66cbb1f0ce0c61f98d935cc94', 'b579f7bcadfb85effab7d92ddb9702aa');
     $this->api = new Shopify('stroman-huels-and-bartoletti1621.myshopify.com', '1305780988', '112690b2ae75e7876ad6e2ae6d3d78cb', 'ae98bcf86ce3dd661d48e18251ba3d3b');
 }
예제 #2
0
<head>
    <title>Shopify API Test</title>
    <style type="text/css">
    body {
        font-family: sans-serif;
        margin: 2em 1em;
        color: #222;
    }
    </style>
</head>
<body>
<?php 
require_once 'shopify.php';
try {
    // setup
    Shopify::setup('9ba1eeb66cbb1f0ce0c61f98d935cc94', 'b579f7bcadfb85effab7d92ddb9702aa');
    // do we have a shop to work with?
    if (empty($_GET['shop'])) {
        // authenticate
        if (!empty($_POST['shop'])) {
            header('Location: https://' . $_POST['shop'] . '/admin/api/auth?api_key=' . Shopify::$api_key);
            exit;
        }
        echo '<form action="demo.php" method="post"><label for="shop">Shop:</label> <input type="text" name="shop"> <input type="submit" value="Authenticate" /></form>';
    } else {
        // run demo
        $api = new Shopify($_REQUEST['shop'], $_REQUEST['timestamp'], $_REQUEST['signature'], $_REQUEST['t']);
        // load shop
        $shop = $api->shop();
        echo '<h1>' . $shop['name'] . '</h1>';
        echo '<h2>' . $api->products->count() . ' Products</h2>';