I'm using Big Commerce as an off-the-shelf shopping cart product. In other words, I don't have access to any server-side code for the shopping cart. To integrate it with Google Checkout, it provides the following URL to use as the API Callback URL for Google Checkout:
https://store.example.com/googlecheckout/xml.php
However, I need to provide my own API Callback URL: https://www.example.com/order/preprocess.php
So, the idea is to receive the request myself at the second URL, do the things I need to do with the data received, and then pass on that original request to my shopping cart so that it can be alerted to the new Google Checkout order. Here's my code:
$rawPostData = file_get_contents("php://input");
$headers = array(
'Content-Type: application/xml; charset=UTF-8',
'HTTPS: on',
'HTTP_USER_AGENT: Google Checkout Notification Agent 1.0',
'HTTP_ACCEPT_ENCODING: gzip',
'Authorization: Basic myBase64MerchantIdColonKey',
'Accept: application/xml;charset=UTF-8'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://store.example.com/googlecheckout/xml.php" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $rawPostData );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec ($ch);
I have confirmed that $rawPostData does indeed cointain the XML data I expect. However, the $result
of curl_exec is false
. The curl code I'm using comes from RAW POST using cURL in PHP.
Any idea why curl_exec
is failing? Might there be other parameters in the original request from Google Checkout that I need to include in my curl request? If so, how would I find those?