Mercurial > hg > ywww
view goodreads/bkp/callbackDev.php @ 43:dbc006408d2b
ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
use dl(...) for debug logging, defined in dlog.php
use doAmazonRequest in amazonBookSearch
use ../private/web.php (q.v., not in mercurial) for Aserver and Aassociates
Started by updating from 40:c24ae74bf6d5, i.e. just before the bug on the main line
| author | Charlie Root |
|---|---|
| date | Sat, 05 Jan 2019 18:00:10 -0500 |
| parents | 077b0a0a3e6d |
| children |
line wrap: on
line source
<?php require_once('GoodreadsAPI.php'); session_start(); if($_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) { //token expired get a new one. You can clear session over here and redirect user to the login link die('Error connecting to Goodreads - please try again'); } $obj = new GoodreadsApi(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $access_token = $obj->getAccessToken($_REQUEST['oauth_verifier']); $_SESSION['access_token'] = $access_token; print_r($access_token); //unset ($_SESSION['oauth_token'], $_SESSION['oauth_token_secret'] ,$obj); $obj = new GoodreadsApi(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); $content = $obj->doGet('http://www.goodreads.com/api/auth_user'); //print_r($content); //you may have to 'view page source' if the relevant XML is not visible in your browser $xml = new SimpleXMLElement($content); $grID = $xml->user->attributes()->id; echo $grID; unset ($obj); ?>
