I’m getting Invalid Request – Error Code 4010 when issuing a reference using this PHP code

$action = ‘reference’;

$url = ‘https://shareasale.com/w.cfm?merchantId=’ . SHARE_A_SALE_MERCHANT_ID . ‘&token=’ . SHARE_A_SALE_TOKEN . ‘&version=1.8&action=’ . $action . ‘&date=’ . $orig_date . ‘&transtype=sale&tracking=’ . $orderID . ‘&ordernumber=’ . $orderID . ‘&amount=’ . $amount;

$url = preg_replace(‘/\s+/’, ”, $url);

$ch = curl_init($url);

$date_utc = date(DATE_RFC1123);
$date_utc = str_replace(‘+0000′,’GMT’, $date_utc); // strip +0000 ???
$secure_string = SHARE_A_SALE_TOKEN . ‘:’ . $date_utc . ‘:’ . $action . ‘:’ . SHARE_A_SALE_SECRET;
$hashed = hash(‘sha256′, $secure_string);

curl_setopt($ch, CURLOPT_HTTPHEADER, Array(“x-ShareASale-Date: $date_utc”, “x-ShareASale-Authentication: $hashed”) );

curl_setopt($ch, CURLOPT_VERBOSE, true);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

if ($timeout > 0)
{

// in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
}

$content=curl_exec($ch);
print_r($content);

curl_close($ch);