Hey Ryan,

I downloaded WAMP5 and tested Reporting API on it and faced the same
issue. The problem is with SSL configuration. I also noticed that the
Apache Server instance bundled is not completely configured.
Most of the file paths in apache/conf/extras/httpd-ssl.conf still
refer to installation directories of default Apache distribution i.e.
"C:\program files\Apache Foundation\... "
Because of this, the certificate bundle for peer verification cannot
be found by cURL. Also, this certificate bundle i.e. 'ca-bundle.crt'
seems to be missing from WAMP5 Apache installation.

I finally managed to get it working by copying over the bundle from
another Apache installation. Alternatively, you can also export
Mozilla certificates using this script:
http://curl.haxx.se/lxr/source/lib/firefox-db2pem.sh

After copying, you need to tell cURL to use it. Modify the
'ExecutePost' method in (Reporting API)/common.php to configure the
SSL options:

function ExecutePost($post_url, $post_document) {

  /* Create a cURL handle. */
  $ch = curl_init();

  //Specify the location of certificate file
  $ca_file = "{path-to-certificate-bundle}\ca-bundle.crt";

  /* Set cURL options. */
  curl_setopt($ch, CURLOPT_URL, $post_url);
  curl_setopt($ch, CURLOPT_POST, true);

  // Set SSL options
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  curl_setopt($ch, CURLOPT_CAINFO,   $ca_file);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post_document);

  $result = curl_exec($ch);  /* Execute the HTTP request. */
  curl_close($ch);           /* Close the cURL handle. */
  return $result;
}

Another simple hack is to tell cURL not to verify peer. To do that
just include this line in your 'ExecutePost' method before curl_exec
($ch).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

-Anirudh

On Dec 2, 8:38 am, Ryan <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I've been trying to utilize the Google Reporting API client for PHP
> (http://code.google.com/p/google-apps-reporting-api-client/) without
> much luck.  I've installed the code on my WAMP5 desktop server, and it
> doesn't seem to be receiving a token.
>
> I did some searching in the Issues for the tracker, and found a few
> people that have written a v1.0.1 and a v1.0.2 (http://code.google.com/
> p/google-apps-reporting-api-client/issues/list).  Both seem to be
> getting me a little closer, but even with the 1.0.2 version, I don't
> seem able to receive any expected data.
>
> Has anyone run into problems utilizing the PHP client for the
> Reporting API?  If so, have you written any code recently that works
> properly with it?
>
> Cheers!
>
> -Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to