cvs: peardoc /en/package/webservices/services-youtube example.xml intro.xml

From: Date: Thu, 28 Sep 2006 16:57:48 +0000
Subject: cvs: peardoc /en/package/webservices/services-youtube example.xml intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-8540@lists.php.net to get a copy of this message
shin Thu Sep 28 16:57:48 2006 UTC Added files: /peardoc/en/package/webservices/services-youtube example.xml intro.xml Log: Initial Relase for Doc. http://cvs.php.net/viewvc.cgi/peardoc/en/package/webservices/services-youtube/example.xml?view=markup&rev=1.1 Index: peardoc/en/package/webservices/services-youtube/example.xml +++ peardoc/en/package/webservices/services-youtube/example.xml <!-- $Revision: 1.1 $ --> <refentry id="package.webservices.services-youtube.example"> <refnamediv> <refname>Example</refname> <refpurpose>Basic examples of Services_YouTube</refpurpose> </refnamediv> <refsect1 id="package.webservices.services-youtube.example.refsect1"> <title>Basic examples of Services_YouTube</title> <simpara> The following examples show how to use some basic features of Services_YouTube: </simpara> <example> <title>Retrieves the public parts of a user profile<./title> <para>This method call youtube.users.get_profile function.</para> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $user_id = "USER_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $user = $youtube->getProfile($user_id); $profile = $user->user_profile; print "{$profile->first_name} {$profile->last_name} :({$profile->video_watch_count} Wathced.)\n"; ]]> </programlisting> </example> <example> <title>Lists a user's favorite videos.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $user_id = "USER_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $videos = $youtube->listFavoriteVideos($user_id); foreach ($videos->xpath('//video') as $i => $video) { print "<img src='{$video->thumbnail_url}' alt='{$video->title}' />\n"; print "<a href='{$video->url}'>URL</a><br />\n"; } ]]> </programlisting> </example> <example> <title>Lists a user's friends.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $user_id = "USER_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $users = $youtube->listFriends($user_id); foreach ($users->xpath('//friend') as $i => $friend) { print "{$friend->user} : Upload: {$friend->video_upload_count}"; } ]]> </programlisting> </example> <example> <title>Lists all videos that have the specified tag.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $tag = "test"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $videos = $youtube->listByTag($tag); foreach ($videos->xpath('//video') as $i => $video) { print "<img src='{$video->thumbnail_url}' alt='{$video->title}' />\n"; print "<a href='{$video->url}'>URL</a><br />\n"; } ]]> </programlisting> </example> <example> <title>Lists all videos that were uploaded by the specified user.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $user_id = "USER_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $videos = $youtube->listByUser($user_id); foreach ($videos->xpath('//video') as $i => $video) { print "<img src='{$video->thumbnail_url}' alt='{$video->title}' />\n"; print "<a href='{$video->url}'>URL</a><br />\n"; } ]]> </programlisting> </example> <example> <title>Lists the most recent 25 videos that have been featured on the front page of the YouTube site.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $videos = $youtube->listFeatured(); foreach ($videos->xpath('//video') as $i => $video) { print "<img src='{$video->thumbnail_url}' alt='{$video->title}' />\n"; print "<a href='{$video->url}'>URL</a><br />\n"; } ]]> </programlisting> </example> <example> <title>Displays the details for a video.</title> <programlisting role="php"> <![CDATA[require_once 'Services/YouTube.php'; $dev_id = "YOUR_DEV_ID"; $video_id = "VIDEO_ID"; $youtube = new Services_YouTube($dev_id, array('usesCache' => true)); $video = $youtube->getDetails($video_id); $details = $video->video_details; print "{$details->title} : ({$details->tags}) : RATE: {$details->rating_avg} in {$detials->rating_count}"; print "<img src='{$details->thumbnail_url}' alt={$details->title}><hr /><hr />"; foreach ($details->xpath('//comment') as $i => $comment) { print "{$comment->author} : {$comment->text}<hr />"; } ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=webservices fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/webservices/services-youtube/intro.xml?view=markup&rev=1.1 Index: peardoc/en/package/webservices/services-youtube/intro.xml +++ peardoc/en/package/webservices/services-youtube/intro.xml <!-- $Revision: 1.1 $ --> <refentry id="package.webservices.services-youtube.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose>Introduction to Services_YouTube</refpurpose> </refnamediv> <refsect1 id="package.webservices.services-youtube.intro.refsect1"> <title>Introduction to Services_YouTube</title> <para> Services_YouTube is an abstraction for the webservice of YouTube APIs. Using YouTube APIs, you can easily integrate online videos from YouTube's rapidly growing repository of videos into your application. To use YouTube API and this package, create a YouTube account and create a YouTube developer profile. </para> <para> YouTube APIs currently allow read-only access to key parts of the YouTube video respository and user community. Services_YouTube provides functions for YouTube APIs using O-O abstraction access. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=webservices fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.pear.doc (#8540) next »