Dienstanwendungen und Google Analytics API V3: Fehler 101 (net :: ERR_CONNECTION_RESET)

Ich versuche ein paar Infos von mir zu bekommenGoogle Analytics Konto mit PHP. Ich habe bereits die Schritte zum Erstellen eines Dienstkontos in der Google Console-API ausgeführtin dieser Antwort. Ich benutze dieGoogle API Client für PHP.

Dies ist der Code, den ich bisher habe:

<?php
$path_to_src = 'src';

// These files are in /src, upload its contents to your web server
require_once $path_to_src . '/Google_Client.php';               
require_once $path_to_src . '/contrib/Google_AnalyticsService.php';

$path_to_keyfile = '***'; //my private key


// Initialise the Google Client object
$client = new Google_Client();

// Your 'Product name'
$client->setApplicationName('My App Name');

$client->setAssertionCredentials(
    new Google_AssertionCredentials(        
        '**', //gserviceaccount mail
        array('https://www.googleapis.com/auth/analytics.readonly'),
        file_get_contents($path_to_keyfile)
    )
);

// Get this from the Google Console, API Access page
$client->setClientId('***'); // my cliente ID
$client->setAccessType('offline_access');
$analytics = new Google_AnalyticsService($client);

// create service and get data
$service = new Google_AnalyticsService($client);

// We have finished setting up the connection,
// now get some data and output the number of visits this week.

// Your analytics profile id. (Admin -> Profile Settings -> Profile ID)
$analytics_id   = 'ga:****'; // my profile id
$lastWeek       = date('Y-m-d', strtotime('-1 week'));
$today          = date('Y-m-d');

try {
    $results = $analytics->data_ga->get($analytics_id, 
                        $lastWeek, 
                        $today,'ga:visits');
    echo '<b>Number of visits this week:</b> ';
    echo $results['totalsForAllResults']['ga:visits'];
} catch(Exception $e) {
    echo 'There was an error : - ' . $e->getMessage();
}

Ich habe das aktiviertopenssl Erweiterung in PHP:

Beim Browsen zum Speicherort des PHP-Skripts erhalte ich fast für immer das Laden und den folgenden Fehler:

Ich benutze PHP 5.4.7:

Nach dem Debuggen des Google API-Client-Codes scheint das Skript in dieser Zeile zu brechen:

if (!openssl_sign($data, $signature, $this->privateKey, "sha256"))

Alles unter dieser Zeile wird nicht aufgerufen. Es sieht so aus, als ob der Fehler in dieser Zeile auftritt. Gibt es hier eine Inkompatibilität oder so?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage