{"errors":"SSL required"} Curl Shopify API

Highlighted
Shopify Partner
8 0 0

<?php

  $apikey = "";
  $password = "";
  $add = "/admin/orders.json";
  $revoke_url = "http://$apikey:$password@fcstore-bluebirdsystems-com.myshopify.com$add";
  $handler = curl_init($revoke_url);
  curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "GET");
  curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($handler, CURLOPT_HEADER, 0);
  curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($handler, CURLOPT_SSL_VERIFYHOST, FALSE);
  $a = curl_exec($handler);
  print_r(json_decode($a)); 
  curl_close($handler);

?>

response

{"errors":"SSL required"}

How to solve this 

0 Likes
Highlighted
Shopify Partner
98 0 16

$revoke_url starts with http.

Change it to https.

Looga.io
0 Likes
Highlighted
Shopify Partner
8 0 0

Changed it to https

The response is false now

0 Likes
Highlighted
Shopify Partner
8 0 0

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://fcstore-bluebirdsystems-com.myshopify.com/admin/orders/count.json",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Cache-Control: no-cache",
    "Postman-Token: c3817153-7022-2b22-cf7d-808960cca56b"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

 

cURL Error #:SSL certificate problem: unable to get local issuer certificate

 

WHY?

0 Likes
Highlighted
Shopify Partner
3 0 0

+1  

 

Shopify Partner Support declined to address it.

0 Likes
Highlighted
Shopify Partner
3 0 0

Turns out the error is completely misleading the developer.  The problem has nothing to do with SSL certs.

 

Triple check your domain formation.  yourname.myshopify.com/admin or yourname.myshopify.com

0 Likes