Пример #1
0
    <body>
        <h1>Convert Token</h1>

        <form action="<?php 
echo $_SERVER['SCRIPT_NAME'];
?>
" method="post">
            <input type="text" size="50" name="token" />
            <input type="submit" value="Convert Token" />
        </form>
    <?php 
if (!empty($token)) {
    ?>
            <p>
                NSID: <?php 
    echo $flickr->getOauthData(Flickr::USER_NSID);
    ?>
<br />
                User Name: <?php 
    echo $flickr->getOauthData(Flickr::USER_NAME);
    ?>
<br />
                Full Name: <?php 
    echo $flickr->getOauthData(Flickr::USER_FULL_NAME);
    ?>
<br />
                Access Token: <?php 
    echo $flickr->getOauthData(Flickr::OAUTH_ACCESS_TOKEN);
    ?>
<br />
                Access Token Secret: <?php 
Пример #2
0
    include $configFile;
} else {
    die("Please rename the config-sample.php file to config.php and add your Flickr API key and secret to it\n");
}
spl_autoload_register(function ($className) {
    $className = str_replace('\\', DIRECTORY_SEPARATOR, $className);
    include dirname(__FILE__) . '/../src/' . $className . '.php';
});
use DPZ\Flickr;
// Build the URL for the current page and use it for our callback
$callback = sprintf('%s://%s:%d%s', @$_SERVER['HTTPS'] == "on" ? 'https' : 'http', $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['SCRIPT_NAME']);
$flickr = new Flickr($flickrApiKey, $flickrApiSecret, $callback);
if (!$flickr->authenticate('read')) {
    die("Hmm, something went wrong...\n");
}
$userNsid = $flickr->getOauthData(Flickr::USER_NSID);
$userName = $flickr->getOauthData(Flickr::USER_NAME);
$userFullName = $flickr->getOauthData(Flickr::USER_FULL_NAME);
$parameters = array('per_page' => 100, 'extras' => 'url_sq,path_alias');
$response = $flickr->call('flickr.stats.getPopularPhotos', $parameters);
$ok = @$response['stat'];
if ($ok == 'ok') {
    $photos = $response['photos'];
} else {
    $err = @$response['err'];
    die("Error: " . @$err['msg']);
}
?>
<!DOCTYPE html>
<html>
    <head>