PHP and Shopify API Dilema, Please help!

Hello!

I am currently creating an app for shopify, and I am using https://github.com/cmcdonaldca/ohShopify.php as the php API which seems to be what everyone uses. However I ran into a few problems.

My code:

<?php
include('shopify.php');

$api_key = 'xxxxxxxxxxxxxxxx;
$secret = 'xxxxxxxxxxxxxxxxx';

$sc = new ShopifyClient($_GET['shop'], $_GET['t'], $api_key, $secret);

try
    {
        // Get all products
        $products = $sc->call('GET', '/admin/products.json', array('published_status'=>'any'));

    }
    catch (ShopifyApiException $e)
    {
        /*
         $e->getMethod() -> http method (GET, POST, PUT, DELETE)
         $e->getPath() -> path of failing request
         $e->getResponseHeaders() -> actually response headers from failing request
         $e->getResponse() -> curl response object
         $e->getParams() -> optional data that may have been passed that caused the failure

        */
    }
    catch (ShopifyCurlException $e)
    {
        // $e->getMessage() returns value of curl_errno() and $e->getCode() returns value of curl_ error()
    }
echo var_dump($products);
?>

Now the problem is that the var_dump results come out NULL, however I do have products in my test store.

This page loads right after the authorization so the $_GET variables are there and filled.

If you can help, I would be forever grateful.

I would change the following two blocks just so you can see what the error is:


catch (ShopifyApiException $e)
    {
         echo $e->getResponse();
    }
    catch (ShopifyCurlException $e)
    {
        echo $e->getMessage();
    }

I did that and I see the error:

“SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failedNULL”

Now, does that mean that their SSL is no good? Because I am on my localhost and I don’t have any certificates. Also how could I fix this issue? Many websites use their API with no problem and I don’t think something would be wrong with a company that big.

Thanks!

It sounds like an issue with the certificate on the server you’re trying to access. It could be an invalid certificate, or it could be self-signed. Where is your shop hosted?b Is it on your server? Are you using a self signed SSL certificate? If so, you can open shopify.php and change line 105

From:


curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

To


curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);