phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
570 stars 210 forks source link

Undefined index: ApiUrl #151

Closed bruceviljoen closed 4 years ago

bruceviljoen commented 4 years ago

I've updated and double checked the my settings in ShopifySDK.php

$config = array( 'ShopUrl' => 'yourshop.myshopify.com', 'ApiKey' => 'YOUR-PRIVATE-API-KEY', 'Password' => 'YOUR-PRIVATE-API-PASSWORD', );

I can't get rid of this error:

Notice: Undefined index: ApiUrl in C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\ShopifyResource.php on line 145

Fatal error: Uncaught PHPShopify\Exception\CurlException: 6 : Could not resolve host: products.json in C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\CurlRequest.php:173 Stack trace: #0 C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\CurlRequest.php(84): PHPShopify\CurlRequest::processRequest(Resource id #1) #1 C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\HttpRequestJson.php(71): PHPShopify\CurlRequest::get('products.json', Array) #2 C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\ShopifyResource.php(337): PHPShopify\HttpRequestJson::get('products.json', Array) #3 C:\inetpub\wwwroot\Shopify\php-shopify-master\index.php(8): PHPShopify\ShopifyResource->get() #4 {main} thrown in C:\inetpub\wwwroot\Shopify\php-shopify-master\lib\CurlRequest.php on line 173

tareqtms commented 4 years ago

Please show your full code (except the ApiKey / Password).

bruceviljoen commented 4 years ago

echo "Composer - Test Page Load";

include("vendor/autoload.php"); $shopify = new PHPShopify\ShopifySDK; $products = $shopify->Product->get();

tareqtms commented 4 years ago

You didn't apply to config to ShopifySDK. It should be like :

echo "Composer - Test Page Load";

include("vendor/autoload.php");
$shopify = new PHPShopify\ShopifySDK($config);
$products = $shopify->Product->get();