Skip to content

Instantly share code, notes, and snippets.

function shopify_call($token, $shop, $api_endpoint, $query = array(), $headers = array(), $method = 'GET') {
// Build URL
$url = "https://" . $shop . ".myshopify.com" . $api_endpoint;
if (is_null($query)) $url = $url . "?" . http_build_query($query);
// Configure cURL
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);