title: PHP Google Checkout Notifications - code sample for sending notification request?
body: <p>I've integrated Google Checkout with a site, got it working / pretending to charge people fine and also processing the order notifications fine.</p>
  
  <p>However, when I make a request back to Google to get the details of the notification, I receive a 400 response, something about invalid XML.</p>
  
  <p>Thing is, everything for this integration so far has been HTML key value pairs, but all of a sudden I need to parse and deal with XML? I may be missing something, but I can't see where in the docs it tells me exactly what my request should look like.</p>
  
  <p>See here: 
  <a href="http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Notification_API.html#Receiving_and_Processing_Notifications" rel="nofollow">http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Notification_API.html#Receiving_and_Processing_Notifications</a></p>
  
  <p>It clearly lists an example with name / value pairs, yet apparently I actually need to send them as XML?</p>
  
  <p>Here's where I am right now:</p>
  
  <pre><code>&lt;?php    $header_arr = array("Authorization: Basic ".$authKey,
                      "Content-Type: application/xml; charset=UTF-8",
              "Accept: application/xml; charset=UTF-8");
  
  $request='type=notification-history-request&amp;serial-number='.$serialNumber;
  
  $ch = curl_init($test_URL);     
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header_arr);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $body = curl_exec($ch);
  
  if (curl_errno($ch)) {
    $log.=', error! :'.curl_error($ch);
  } else {
    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $log.=', status code is: '.$status_code;  //400
  }
  ?&gt;
  </code></pre>
  
  <p>This returns a 400 each time - yes I realise I'm setting an accept header for XML, this is as the docs specify, here: <a href="http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API.html#https_auth_scheme" rel="nofollow">http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API.html#https_auth_scheme</a></p>
  
  <p>So, I find myself needing to send the correct request... any ideas?</p>
  
  <p>P.S I've also checked through google's sample code but it's so layered and dependency-ridden that while I've managed to use some of it, the rest is a mystery - so unless you can give me line numbers, the samples aren't much help</p>