Пример #1
0
		echo '</pre>';
		*/
// Loop through videos showing just the thumbnail
// with a link to the video itself.
foreach ($videos['list_result']['video_list'] as $video) {
    echo '<a href="' . $video['url'] . '"><img src="' . $video['thumbnail_url'] . '" alt="thumbnail" width="60" /></a> ';
}
?>
</p>
		
		
		<h2><a href="http://developers.viddler.com/documentation/api-v2/">viddler.users.getProfile</a></h2>
		<p>Show a user's profile.</p>
		<?php 
// Search videos: type=allvideos, query=iphone, videos 5
$userInfo = $v->viddler_users_getProfile(array('user' => 'cdevroe'));
/*
echo '<pre>';
print_r($userInfo);
echo '</pre>';
*/
echo '<p><strong>Username:</strong> ' . $userInfo['user']['username'] . '</p>';
echo '<p><strong>Avatar:</strong> <img src="' . $userInfo['user']['avatar'] . '" /></p>';
echo '<p><strong>Number of videos:</strong> ' . $userInfo['user']['video_upload_count'] . '</p>';
?>
		<p>Note: If Avatar is blank you should use default. More profile variables are available, review doc.</p>
		
		<p>Please feel free to add more examples. Most GET requests return similar results though.</p>
		
	</body>
</html>
Пример #2
0
<?php

//Example to auth as you and get your videos
include '../phpviddler.php';
//Create viddler object using HTTPS:443
$v = new Viddler_V2('YOUR API KEY', TRUE);
//Authenticate as you
//Always a good idea even if your profile is public
//Because if at anytime you turn to a private account
//Your application will still work ;)
$auth = $v->viddler_users_auth(array('user' => 'YOUR USERNAME', 'password' => 'YOUR PASSWORD'));
//Get your session id
$session_id = isset($auth['auth']['sessionid']) ? $auth['auth']['sessionid'] : '';
//If no session id, print errors
if (!empty($session_id)) {
    $info = $v->viddler_users_getProfile(array('sessionid' => $session_id));
    //If any errors print them out
    //This should NOT be done in a production application
    //An exception should be used instead
    //For example purposes only
    if (isset($info['error'])) {
        echo '<pre>';
        print_r($info);
        echo '</pre>';
        exit;
    }
} else {
    echo '<pre>';
    print_r($auth);
    echo '</pre>';
    exit;