FROM CACHE - en_header

Error In Integrating Shopify API using Curl

Akash6
New Member
2 0 0

Hello Sir,

I am continiously getting below error

{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}

  I have used below lineon code,

$username = "API_KEY";//Note:Here i have use api key
$password = "API_SHARED_SECRET";//Note:Here i have use api shared secret key
$shop_domain = "at-tiutest.myshopify.com";
echo $url = 'https://'.$username.':'.$password.'@'.$shop_domain. '/admin/orders.json';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
//$request_headers[] = "X-Shopify-Access-Token: dfa1d2da40d6f9a72c57b15232a20d33";
//curl_setopt($curl, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_HEADER, 1);
//curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($products_array));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec ($curl);
curl_close ($curl);
echo "<pre>";
print_r($response);

I would like to request you please let me know what's wrong with Code or processes...?

 

 

Reply 1 (1)
Pawel
Shopify Partner
3 0 0

Hi, I am not sure what are you trying to do and I don't know if you already resolved your issue but try just use for example postman to make a this connection with your Admin API. 

I get example of the URL from the Private Apps dashboard / Admin API section and used it and it works for me. If so it will be works for you then you have to look on cURL configuration to get a http GET call.