This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Set variables for our request | |
| $shop = "demo-shop"; | |
| $api_key = "1r30mrvCFMfq2DLGuIXyY2veEJVgTtDD"; | |
| $scopes = "read_orders,write_products"; | |
| $redirect_uri = "http://localhost/generate_token.php"; | |
| // Build install/approval URL to redirect to | |
| $install_url = "https://" . $shop . ".myshopify.com/admin/oauth/authorize?client_id=" . $api_key . "&scope=" . $scopes . "&redirect_uri=" . urlencode($redirect_uri); | |
| // Redirect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Set variables for our request | |
| $shared_secret = "TBB5wltKarRtKn5mUVZck9RxHePNN6Jo"; | |
| $code = $_GET["code"]; | |
| $timestamp = $_GET["timestamp"]; | |
| $signature = $_GET["signature"]; | |
| // Compile signature data | |
| $signature_data = $shared_secret . "code=" . $code . "shop=". $shop . ".myshopify.comtimestamp=" . $timestamp; | |
| // Use signature data to check that the response is from Shopify or not |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Set variables for our request | |
| $shop = "demo-shop"; | |
| $request_headers = array( | |
| "Content-type" => "application/json", // Tell Shopify that we're expecting a response in JSON format | |
| "client_id" => "1r30mrvCFMfq2DLGuIXyY2veEJVgTtDD", // Your app API key | |
| "client_secret" => "TBB5wltKarRtKn5mUVZck9RxHePNN6Jo", // Your app credentials (secret key) | |
| "code" => $_GET["code"] // Grab the access key from the URL | |
| ); | |
| // Call our Shopify function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Set variables for our request | |
| $shop = "demo-shop"; | |
| $token = "SWplI7gKAckAlF9QfAvv9yrI3grYsSkw"; | |
| $query = array( | |
| "Content-type" => "application/json" // Tell Shopify that we're expecting a response in JSON format | |
| ); | |
| // Run API call to get all products | |
| $products = shopify_call($token, $shop, "/admin/products.json", array(), 'GET'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Convert product JSON information into an array | |
| $products = json_decode($products['response'], TRUE); | |
| // Get the ID of the first product | |
| $product_id = $products['products'][0]['id']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Convert product JSON information into an array | |
| $products = json_decode($products['response'], TRUE); | |
| // Get the ID of the first product | |
| $product_id = $products['products'][0]['id']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Modify product data | |
| $modify_data = array( | |
| "product" => array( | |
| "id" => $product_id, | |
| "title" => "My New Title" | |
| ) | |
| ); | |
| // Run API call to modify the product | |
| $modified_product = shopify_call($token, $shop, "/admin/products/" . $product_id . ".json", $modify_data, 'PUT'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://localhost/generate_token.php?code={authorization_code}&signature=da9d83c171400a41f8db91a950508985×tamp=1409617544 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| asdasd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select | |
| LOWER(ep2.value) as value, | |
| count( * ) as counts | |
| from | |
| tracks.prod_events as events, | |
| events.eventprops as ep, | |
| events.eventprops as ep2 | |
| where | |
| dateymd between 20190110 and 20190212 and | |
| eventname = 'wpcom_hook_wpmu_new_blog' and |