This isn't going to win any awards, but at least it returns private albums.
Let me know if this doesn't work for you.
session_start();
$client = new apiClient();
$client->setApplicationName("Google UserInfo PHP Starter Application");
// Visit https://code.google.com/apis/console?api=plus to generate your
// oauth2_client_id, oauth2_client_secret, and to register your
oauth2_redirect_uri.
$client->setClientId('********');
$client->setClientSecret('******');
$client->setRedirectUri('********');
$client->setDeveloperKey('********');
// Add picasaweb scope!
$client->setScopes(array('https://picasaweb.google.com/data'));
$oauth2 = new apiOauth2Service($client);
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] .
$_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if (isset($_REQUEST['logout'])) {
unset($_SESSION['token']);
$client->revokeToken();
}
if ($client->getAccessToken()) {
print "<div>Get Access Token.</div><br>";
////////////////////////////////////////////
// This is the good stuff.
///////////////////////////////////////////
$requestUrl = "
https://picasaweb.google.com/data/feed/api/user/default?kind=album&v=2&access=private
";
$request = new apiHttpRequest($requestUrl);
$curl = new apiCurlIO();
$response = $curl->authenticatedRequest($request);
print("Response Code " . $response->getResponseHttpCode() . "</br>");
print("Response body " . $response->getResponseBody() . "</br>");
// The access token may have been updated lazily.
$_SESSION['token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
print "<a href='$authUrl'>Connect Me!</a>";
}
-m.e.
On Tue, Aug 14, 2012 at 11:40 AM, James Callahan <
[email protected]> wrote:
> awesome thanks! im not good with php but managed to get this far.
>
>
> On Tuesday, August 14, 2012 1:50:44 PM UTC-4, Mike Erickson wrote:
>
>> Ah, I think I understand now. The authkey is a unique identifier that
>> gives you access to a specific album, but does not give you general access
>> to private albums. It seems you were trying to get around the problem that
>> your authentication doesn't appear to be making it into your request
>> headers.
>>
>> One way to make sure your auth headers are set is to make a query for an
>> "only you" album. If your request is not authenticated, it won't work, but
>> if it is then the album feed will work fine.
>>
>> I'll take a look at your code sample again this afternoon. I wasn't able
>> to get t working last time, but I'm not very good with PHP.
>> On Aug 14, 2012 8:03 AM, "James Callahan" <jamestcallah...@**gmail.com>
>> wrote:
>>
>>> So I looked further into the picasa api and im wondering if what im
>>> trying to do is even possible within the api. First of all I had my album
>>> share to "only me" so I moved it to "Limited, must have link" which then I
>>> noticed is where google gives you an authkey in the link they provide so
>>> people can view the album. So now im wondering does the api have a call for
>>> that generated number or is it just random and I can't access it?
>>>
>>> I've seen others talk about getting the authkey but they are putting it
>>> in themselves.. and I think their authkey is actually just the album
>>> authkey.... You can move multiple albums into the unlisted section and I
>>> believe that authkey is what gives you visibility.
>>>
>>> This is the link they give me to the unlisted
>>> https://picasaweb.google.com/**108822373128819829392/Picasa?**
>>> authkey=randomgeneratedkey<https://picasaweb.google.com/108822373128819829392/Picasa?authkey=randomgeneratedkey>
>>>
>>> And this is the feedURL that I am using
>>> http://picasaweb.google.com/**data/feed/api/user/$userid/?**
>>> kind=photo&access=visible&**authkey=randomgeneratedkey<http://picasaweb.google.com/data/feed/api/user/$userid/?kind=photo&access=visible&authkey=randomgeneratedkey>
>>>
>>> my thoughts at first were... maybe I can just use the unlisted link but
>>> realised its just a web address I can't pull from. Im starting to think
>>> what I want done can't be done yet.
>>>
>>> this makes me sad :(
>>>
>>> On Monday, August 13, 2012 2:13:46 PM UTC-4, Mike Erickson wrote:
>>>>
>>>> It seems like you are just trying to find the authkey param the photo
>>>> Feed? Your best bet is to find the feed element then use
>>>> parse_url<http://php.net/manual/en/function.parse-url.php> to
>>>> pull off the query string. Then you can split the queries and grab the
>>>> authkey.
>>>>
>>>> Sounds like a reasonable solution?
>>>> -Mike
>>>>
>>>> -m.e.
>>>>
>>>>
>>>> On Mon, Aug 13, 2012 at 11:01 AM, James Callahan <jamestcallah...@**
>>>> gmail.com> wrote:
>>>>
>>>>> working with the picasa API with php and simple xml.
>>>>>
>>>>> I currently have my feed like so...
>>>>>
>>>>> $feedURL = "http://picasaweb.google.com/**d**
>>>>> ata/feed/api/user/$userid/?**kin**d=photo<http://picasaweb.google.com/data/feed/api/user/$userid/?kind=photo>
>>>>> ";
>>>>> $sxml = simplexml_load_file($feedURL);
>>>>>
>>>>>
>>>>> is there a way I can display that info on the page with a print_r? I
>>>>> want to see every single attribute, tag, etc. that there is with that link
>>>>> so I can try and figure out how to get the authkey. I see it added at the
>>>>> end of the feedURL in [href] when I do an echo on the $sxml
>>>>>
>>>>> something like this...
>>>>>
>>>>> [link] => Array
>>>>> (
>>>>> [0] => SimpleXMLElement Object
>>>>> (
>>>>> [@attributes] => Array
>>>>> (
>>>>> [rel] =>
>>>>> http://schemas.google.com/g/**20**05#feed
>>>>> <http://schemas.google.com/g/2005#feed>
>>>>> [type] => application/atom+xml
>>>>> [href] =>
>>>>> http://picasaweb.google.com/**da**ta/feed/api/user/**1088223731288**19829392/albumid/**5774774167439**695457/photoid/**577477417124793**8738?authkey=**Hgi37aezOS0
>>>>>
>>>>> <http://picasaweb.google.com/data/feed/api/user/108822373128819829392/albumid/5774774167439695457/photoid/5774774171247938738?authkey=Hgi37aezOS0>
>>>>> )
>>>>>
>>>>> )
>>>>>
>>>>>
>>>>>
>>>>> I need to figure out how to get that authkey into a variable so I can
>>>>> add it to the feedURL.
>>>>>
>>>>> on the site I have people will be logging in with their credentials
>>>>> and right now they can but they can't see their private albums in picasa.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google Picasa Web Albums API" group.
>>>>> To view this discussion on the web visit https://groups.google.com/d/*
>>>>> *ms**g/google-picasa-data-api/-/**CBb**AgjZwY5kJ<https://groups.google.com/d/msg/google-picasa-data-api/-/CBbAgjZwY5kJ>
>>>>> .
>>>>> To post to this group, send email to google-pica...@**googlegroups.**
>>>>> com.
>>>>> To unsubscribe from this group, send email to google-picasa-data-api+*
>>>>> *unsubsc**[email protected].
>>>>> For more options, visit this group at http://groups.google.com/**group
>>>>> **/google-picasa-data-api?**hl=en<http://groups.google.com/group/google-picasa-data-api?hl=en>
>>>>> .
>>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Picasa Web Albums API" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/google-picasa-data-api/-/**vQ2rwxYE7DwJ<https://groups.google.com/d/msg/google-picasa-data-api/-/vQ2rwxYE7DwJ>
>>> .
>>> To post to this group, send email to google-pica...@**googlegroups.com.
>>> To unsubscribe from this group, send email to google-picasa-data-api+**
>>> [email protected].
>>> For more options, visit this group at http://groups.google.com/**
>>> group/google-picasa-data-api?**hl=en<http://groups.google.com/group/google-picasa-data-api?hl=en>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Google Picasa Web Albums API" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-picasa-data-api/-/A5I0hHhk4IEJ.
>
> 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-picasa-data-api?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" 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-picasa-data-api?hl=en.