I checked out rev412 from trunk of Google PHP client for API. I'm using prediction/serviceAccount.php example (with service changed to shopping API as in shopping/simple.php)
(as on php manual, where there seems to be no support for sha256 algo in some versions)
276 Stack trace: #0 .....\src\auth\apiOAuth2.php(253): apiOAuth2->refreshTokenRequest(Array) #1 ...\src\auth\apiOAuth2.php(206): apiOAuth2->refreshTokenWithAssertion() #2 .....\src\service\apiServiceResource.php(167): apiOAuth2->sign(Object(apiHttpRequest)) #3 .....\src\contrib\apiShoppingService.php(91): apiServiceResource->__call('list', Array) #4 ...... in
......\src\auth\apiOAuth2.php on line
276Is there a specific php version(s) supported by the spi-php-client?
Alessandro
_____________________________________________php code_____________________________
require_once '....../src/apiClient.php';
require_once '....../src/contrib/apiShoppingService.php';
define('KEY_FILE', 'my key file );
define('SERVICE_ACCOUNT_NAME', '???');
define('CLIENT_ID', 'my client ID');
$client = new apiClient();
$client->setApplicationName("Google Shopping Sample");
session_start();
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
$key = file_get_contents(KEY_FILE);
$client->setAssertionCredentials(new apiAssertionCredentials(
SERVICE_ACCOUNT_NAME,
array('
https://www.googleapis.com/auth/structuredcontent'),
$key)
);
$client->setClientId(CLIENT_ID);
// Visit
https://code.google.com/apis/console?api=shopping to generate your
// Simple API Key.
$client->setDeveloperKey('my developer key');
$service = new apiShoppingService($client);
$source = "gan:xxxxxxx";
// For more information about full text search with the shopping API, please
// see
http://code.google.com/apis/shopping/search/v1/getting_started.html#text-search$query = "\"mp3 player\" | ipod";
$ranking = "relevancy";
$results = $service->products->listProducts($source, array(
"country" => "US",
"q" => $query,
"rankBy" => $ranking,
));
print "<h1>Shopping Results</h1><pre>" . print_r($results, true) . "</pre>";
// We're not done yet. Remember to update the cached access token.
// Remember to replace $_SESSION with a real database or memcached.
if ($client->getAccessToken()) {
$_SESSION['token'] = $client->getAccessToken();