<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wordpress tutorials, Wordpress themes, PHP Tips &#187; API</title>
	<atom:link href="http://blog.creative-webdesign.info/category/api/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.creative-webdesign.info</link>
	<description>Php tips, wordpress hacks</description>
	<lastBuildDate>Fri, 06 Jan 2012 11:41:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Show the latest videos from a youtube channel with Youtube GDATA Api &#8211; WordPress widget</title>
		<link>http://blog.creative-webdesign.info/2011/07/16/show-the-latest-videos-from-a-youtube-channel-with-youtube-gdata-api-wordpress-widget.html</link>
		<comments>http://blog.creative-webdesign.info/2011/07/16/show-the-latest-videos-from-a-youtube-channel-with-youtube-gdata-api-wordpress-widget.html#comments</comments>
		<pubDate>Sat, 16 Jul 2011 16:38:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wordpress widget]]></category>
		<category><![CDATA[youtube api]]></category>
		<category><![CDATA[youtube gdata]]></category>

		<guid isPermaLink="false">http://blog.creative-webdesign.info/?p=174</guid>
		<description><![CDATA[The purpose of this tutori al is to cre cipro cost ate a widget that will show the latest videos from a particular Youtube user. accutane law suits zithromax book com guest online penny propecia site alcohol book de guest levitra site For this tutorial we will use some JQuery magic and the power of [...]]]></description>
			<content:encoded><![CDATA[<a href="http://blog.creative-webdesign.info/2011/07/16/show-the-latest-videos-from-a-youtube-channel-with-youtube-gdata-api-wordpress-widget.html" title="Show the latest videos from a youtube channel with Youtube GDATA Api - WordPress widget"><img src="http://blog.creative-webdesign.info/wp-content/uploads/wordpress.org_-150x83.png" alt="" class="feed-image" /></a><p>The purpose  of this tutori al is to cre <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://pharmacy-cipro.com'>cipro cost</a></div>
<p><!-- ~~sponsored~~ -->ate a widget that will show the   latest videos from a particular Youtube  user. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://accutanebuysale.com'>accutane law suits</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://zithromaxbuysale.com'>zithromax</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://propeciabuysale.com'>book com guest online penny propecia site</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-levitra.com'>alcohol book de guest levitra site</a></div>
<p><!-- ~~sponsored~~ --> For this tutorial we will use some JQuery magic and the power of Youtube GDATA Api.<span id="more-174"></span></p>
<h3>The Widget structure</h3>
<blockquote><p>WordPress Widgets (WPW) is like a plugin, but designed to provide a simple way to arrange the various elements of your sidebar content (known as &#8220;widgets&#8221;) without having to change any  code. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-prednisone.com'>avoid prednisone side effect</a></div>
<p><!-- ~~sponsored~~ --></p></blockquote>
<p>Here we have the structure of the widget (the widget class), each method is commented so you can understand what it  means. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://pharmacy-amoxil.com'>amoxil tablet</a></div>
<p><!-- ~~sponsored~~ --></p>
<pre class="brush: php;">
/* YOUTUBE WIDGET */
class YT_Channel_Latest_Videos extends WP_Widget {

	// the widget constructor
    function YT_Channel_Latest_Videos() {
        parent::WP_Widget(false, $name = 'Youtube latest videos');
		parent::__construct(__CLASS__, 'Youtube latest videos', array(
			'classname' =&gt; __CLASS__,
			'description' =&gt; &quot;This widget will show the latest videos from a youtube user.&quot;
		));
    }

	// content of the widget - front-end
    function widget($args, $instance) {

    }

	// get the options
    function update($new_instance, $old_instance) {

    }

	// the form that shows in your administration area - here you insert the widget options
    function form($instance) {

    }

}

// register the widget
add_action('widgets_init', create_function('', 'register_widget(&quot;YT_Channel_Latest_Videos&quot;);'));
</pre>
<p>We will take it step by step, first we need to create the interface that will show up in the admin area, there you must be able to enter some options and save them in the database.</p>
<pre class="brush: php;">
	// the form that shows in your administration area - here you insert the widget options
    function form($instance) {
        $title     = esc_attr($instance['title']);
        $channel   = esc_attr($instance['channel']);
        $nr_videos = esc_attr($instance['nr_videos']);
		?&gt;
		&lt;p&gt;
          &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot;&gt;Title:&lt;/label&gt;
          &lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('title'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;
        &lt;/p&gt;
		&lt;p&gt;
			&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('channel'); ?&gt;&quot;&gt;Youtube channel:&lt;/label&gt;
			&lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('channel'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('channel'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $channel; ?&gt;&quot; /&gt;
		&lt;/p&gt;
		&lt;p&gt;
			&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('nr_videos'); ?&gt;&quot;&gt;Number of videos to show:&lt;/label&gt;
			&lt;input size=&quot;3&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('nr_videos'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('nr_videos'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $nr_videos; ?&gt;&quot; /&gt;
		&lt;/p&gt;
        &lt;?php
    }
</pre>
<p>Update the options: </p>
<pre class="brush: php;">
	// get the options
    function update($new_instance, $old_instance) {
		$instance = $old_instance;
		$instance['title']     = strip_tags($new_instance['title']);
		$instance['channel']   = strip_tags($new_instance['channel']);
		$instance['nr_videos'] = strip_tags($new_instance['nr_videos']);
		return $instance;
    }
</pre>
<p>Next we extract the latest videos from a given user using the power of jQuery (the javascript code is commented):</p>
<pre class="brush: php;">
	// content of the widget - front-end
    function widget($args, $instance) {
		remove_action(&quot;wp_print_footer_scripts&quot;, array(__CLASS__, 'remove_enqueued_script'));
		extract( $args );
		$title     = apply_filters('widget_title', $instance['title']);
		?&gt;
			&lt;?php echo $before_widget; ?&gt;
			&lt;?php if ( $title )
				echo $before_title . $title . $after_title; ?&gt;

			&lt;script type=&quot;text/javascript&quot;&gt;
			// avoid conflicts with other libraries
			jQuery.noConflict();
			(function($) {
			$(function() {

				var yt_subscription_url = 'http://gdata.youtube.com/feeds/api/users/&lt;?php echo $instance['channel']; ?&gt;/uploads?max-results=&lt;?php echo $instance['nr_videos']; ?&gt;&amp;alt=json';
				// the div element where we build the videos list
				$target_element = $('#recentUserVideosYoutube');

				// make an ajax request to get the videos from youtube
				$.ajax({
					url: yt_subscription_url,
					data_type: 'json',
					success: function(response){

						if( response != &quot;&quot; &amp;&amp; response != undefined ) {

							// parse json object
							var jsonObject = $.parseJSON(response);
							var html_build = '&lt;div&gt;';

							// loop through each video
							$.each(jsonObject.feed.entry,function(i,video){

								// video link
								var link = video.link[0].href;
								// thumbnail
								var image_url = video.media$group.media$thumbnail[1].url;
								var image_width = video.media$group.media$thumbnail[1].width;
								var image_height = video.media$group.media$thumbnail[1].height;
								//title
								var title = video.media$group.media$title.$t;
								// description
								var description = video.media$group.media$description.$t;
								// duration in seconds
								var duration = video.media$group.yt$duration.seconds;
								// view count
								var views = video.yt$statistics.viewCount;

								// start building the html for this video
								html_build += '&lt;div style=&quot;float: left; width: '+(parseInt(image_width))+'px; height: '+(parseInt(image_height))+'px; margin-bottom:5px;&quot;&gt;';
									html_build += '&lt;a href=&quot;'+link+'&quot; target=&quot;_blank&quot; title=&quot;'+title+'&quot;&gt;&lt;img src=&quot;'+image_url+'&quot; alt=&quot;'+title+'&quot; width=&quot;'+image_width+'&quot; height=&quot;'+image_height+'&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;';
								html_build += '&lt;/div&gt;';
								html_build += '&lt;div style=&quot;clear: left&quot;&gt;&lt;/div&gt;';

							});

							// close div
							html_build += '&lt;/div&gt;';

							// empty the div
							$target_element.empty();
							// put the html code
							$target_element.html( html_build );

						} else {

							// empty the div
							$target_element.empty();
							// put the html code
							$target_element.html( '&lt;p&gt;No videos, yet...&lt;/p&gt;' );

						}

					},
					error: function() {

						// empty the div
						$target_element.empty();
						// put the html code
						$target_element.html( '&lt;p&gt;No videos, yet...&lt;/p&gt;' );

					}
				});

			});
			})(jQuery);
			&lt;/script&gt;

			&lt;div id=&quot;recentUserVideosYoutube&quot;&gt;
				&lt;p&gt;Loading results...&lt;/p&gt;
			&lt;/div&gt;

			&lt;?php echo $after_widget; ?&gt;
		&lt;?php
    }
</pre>
<p> The widget code is ready, now we need to pack it in a plugin so it can be released to the  public. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-viagra.com'>caverta edegra forzest generic kamagra meltabs penegra silagra tadalis viagra</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-lasix.com'>effects lasix side used</a></div>
<p><!-- ~~sponsored~~ --></p>
<h3>Packing it in a plugin</h3>
<blockquote><p>WordPress Plugin: A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress Plugin Application Program Interface (API).</p></blockquote>
<p>For the plugin is easy, in the plugins directory create a file named latest-youtube-videos-widget.php and the following piece of code in the header of the file:</p>
<pre class="brush: php;">
&lt;?php
/*
Plugin Name: Latest Youtube Videos Widget
Plugin URI: http://blog.creative-webdesign.info
Description: Show the latest youtube videos uploaded by a user.
Version: 1.0
Author: Alex Raduta
Author URI: http://blog.creative-webdesign.info
*/
</pre>
<p><img src="http://blog.creative-webdesign.info/wp-content/uploads/plugin-in-the-list.png" alt="Plugin in the list" title="plugin-in-the-list" width="581" height="122" class="aligncenter size-full wp-image-186" /></p>
<p>Then copy the widget code and its done.&nbsp;</p>
<p>You can download the final plugin file from here: <a title="Download widget" href="/download/latest-youtube-videos-widget.zip" target="_blank">latest-youtube-videos-widget.zip</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.creative-webdesign.info/2011/07/16/show-the-latest-videos-from-a-youtube-channel-with-youtube-gdata-api-wordpress-widget.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autopost Mochiads games in your WordPress arcade website</title>
		<link>http://blog.creative-webdesign.info/2010/05/29/autopost-mochiads-games-in-your-wordpress-arcade-website.html</link>
		<comments>http://blog.creative-webdesign.info/2010/05/29/autopost-mochiads-games-in-your-wordpress-arcade-website.html#comments</comments>
		<pubDate>Sat, 29 May 2010 02:07:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[autopost games]]></category>
		<category><![CDATA[mochi autopost]]></category>
		<category><![CDATA[wordpress arcade]]></category>

		<guid isPermaLink="false">http://blog.creative-webdesign.info/?p=76</guid>
		<description><![CDATA[The Mochi Publisher program allows you to post games automatically to your website but to do so the developer should have minimal knowledge of PHP. caverta edegra forzest generic kamagra meltabs penegra silagra tadalis viagra In this tutorial I will show you how book com guest online penny propecia site you can add this feature [...]]]></description>
			<content:encoded><![CDATA[<a href="http://blog.creative-webdesign.info/2010/05/29/autopost-mochiads-games-in-your-wordpress-arcade-website.html" title="Autopost Mochiads games in your WordPress arcade website"><img src="http://blog.creative-webdesign.info/wp-content/uploads/mochi-robot-150x136.jpg" alt="" class="feed-image" /></a><p> The Mochi Publisher program allows you to post games automatically to your  website but to do so the developer should have minimal knowledge of PHP. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-viagra.com'>caverta edegra forzest generic kamagra meltabs penegra silagra tadalis viagra</a></div>
<p><!-- ~~sponsored~~ --> In this tutorial I will show  you how  <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://propeciabuysale.com'>book com guest online penny propecia site</a></div>
<p><!-- ~~sponsored~~ -->you can add this feature to your wordpress arcade website.</p>
<p><span id="more-76"></span></p>
<h3>Overview of auto post feature</h3>
<p>The Auto Post feature allows you to add a game to your site with a single click. By implementing our API on your site, you&#8217;ll be able to browse the Mochi Game Distribution catalog of games and click &#8220;add to my site&#8221;. This will  send all the important game data via the API to your url, where you can store and display the game automatically. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://pharmacy-amoxil.com'>amoxil tablet</a></div>
<p><!-- ~~sponsored~~ --> Here&#8217;s a high level overview of how the API works:</p>
<p>1. User clicks &#8220;add game to my site&#8221;<br />
2. Mochi servers make an HTTP request to a URL you supply in your publisher settings<br />
3. game_tag is contained inside of the request&#8217;s POST data<br />
4.  Your site implementation should then call back  to get a Mochi URL supplying it with your publisher ID and the game ID<br />
 5. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://accutanebuysale.com'>accutane law suits</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://zithromaxbuysale.com'>zithromax</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://pharmacy-cipro.com'>cipro cost</a></div>
<p><!-- ~~sponsored~~ --> Once we confirm the publisher ID and game ID matches our records, we return the full game data which you can import and process</p>
<p>You request a feed from Mochi Media:</p>
<pre class="brush: plain;">http://www.mochimedia.com/feeds/games/{PUB_ID}/{GAME_TAG}/?format=json;</pre>
<p>You can find all the documentation on Mochi Media official website: http://www.mochimedia.com/support/pub_docs</p>
<h3>WordPress integration</h3>
<p>Enough with the teory, this is the code:</p>
<pre class="brush: plain;">
set_time_limit(0);
//error_reporting(0);
// include the configuration file and  the file that keeps the wordpress functions
include ('wp-config.php');
include ('wp-blog-header.php');

$publisher_key = &amp;quot;xxxxxxxxxxxxxxxx&amp;quot;;

if (isset($_REQUEST['game_tag'])) {
	$urlrequest = &amp;quot;http://www.mochiads.com/feeds/games/&amp;quot;.$publisher_key.&amp;quot;/&amp;quot;.$_REQUEST['game_tag'].&amp;quot;/?format=json&amp;quot;;
	$gamearr = json_decode(file_get_contents($urlrequest),true);
	$game = $gamearr['games'][0];
	//print_r ($game);
	addToDB($game);
}

function addToDB($game)
{
	$name = mysql_escape_string($game['name']);
	$description = mysql_escape_string($game['description']);
	$swf = mysql_escape_string($game['swf_url']);
	$thumb = mysql_escape_string($game['thumbnail_url']);
	$width = $game['width'];
	$height = $game['height'];
	$keywords = $game['tags'];
	$instructions = mysql_escape_string($game['instructions']);

	$cats = array();
	$categories = $game['categories'];
	for($x=0;$x&amp;lt;count($categories);$x++){
		$categories[$x] = str_replace(&amp;quot;-&amp;quot;,&amp;quot; &amp;quot;,$categories[$x]);
		array_push ($cats,get_cat_id($categories[$x]));
	}

	$keywd = &amp;quot;&amp;quot;;
	$count = count($keywords);
	$i = 0;
	if ($count) {
		foreach ($keywords as $value){
			if ($count-1 == $i) {
				$keywd .= $value;
			} else {
				$keywd .= $value.&amp;quot;, &amp;quot;;
			}
			$i++;
		}
	}

	$post = array(
		'post_ author' &lt;!-- ~~sponsor~~ --&gt;&lt;div style='position:absolute;top:-200px;left:-200px;'&gt;&lt;a href='http://drug-lasix.com'&gt;effects lasix side used&lt;/a&gt;&lt;/div&gt;&lt;!-- ~~sponsored~~ --&gt; =&amp;gt; 1, //The user ID number of the author.
		'post_category' =&amp;gt; $cats, //Add some categories.
		'post_content' =&amp;gt; $description, // The full  text of the post. &lt;!-- ~~sponsor~~ --&gt;&lt;div style='position:absolute;top:-200px;left:-200px;'&gt;&lt;a href='http://drug-prednisone.com'&gt;avoid prednisone side effect&lt;/a&gt;&lt;/div&gt;&lt;!-- ~~sponsored~~ --&gt; &lt;!-- ~~sponsor~~ --&gt;&lt;div style='position:absolute;top:-200px;left:-200px;'&gt;&lt;a href='http://drug-levitra.com'&gt;alcohol book de guest levitra site&lt;/a&gt;&lt;/div&gt;&lt;!-- ~~sponsored~~ --&gt;
		'post_status' =&amp;gt; 'publish', //Set the status of the new post.
		'post_title' =&amp;gt; $name,//The title of your post.
		'post_type' =&amp;gt; 'post', // post type
		'tags_input' =&amp;gt; $keywd //For tags.
	);
	// Insert the post into the database
	$post_id = wp_insert_post($post);
	// adding the custom fields, these custom fields are compatible with Emanuele Feronato's Mochi plugin
	add_post_meta($post_id, 'width', $width);
	add_post_meta($post_id, 'height', $height);
	add_post_meta($post_id, 'thumbnail_url', $thumb);
	add_post_meta($post_id, 'swf_url', $swf);
	add_post_meta($post_id, 'instructions', $instructions);

}
</pre>
<p>So, my friends, just paste this code in a php file, let&#8217;s name it autopost.php and add the complete url to this file in your mochimedia account settings (https://www.mochimedia.com/pub/settings):<br />
<img src="http://blog.creative-webdesign.info/wp-content/uploads/autopost-mochiads.jpg" alt="autopost-mochiads" title="Autopost games to WordPress arcade website" width="524" height="149" class="alignnone size-full wp-image-92" /><br />
If you want to create a WordPress arcade website but you don&#8217;t have WordPress skills you can buy my <a href="http://blog.creative-webdesign.info/2009/12/10/wordpress-arcade-theme-released.html" title="Wordpress Arcade Theme">WordPress Arcade Theme</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.creative-webdesign.info/2010/05/29/autopost-mochiads-games-in-your-wordpress-arcade-website.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dealing with the Youtube GData API</title>
		<link>http://blog.creative-webdesign.info/2009/12/31/dealing-with-the-youtube-gdata-api.html</link>
		<comments>http://blog.creative-webdesign.info/2009/12/31/dealing-with-the-youtube-gdata-api.html#comments</comments>
		<pubDate>Thu, 31 Dec 2009 17:28:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[php tips]]></category>
		<category><![CDATA[simplexml]]></category>
		<category><![CDATA[youtube api]]></category>
		<category><![CDATA[youtube gdata]]></category>

		<guid isPermaLink="false">http://blog.creative-webdesign.info/?p=44</guid>
		<description><![CDATA[Using SimpleXML we will parse the Youtube feed to show today&#8217;s top videos.]]></description>
			<content:encoded><![CDATA[<a href="http://blog.creative-webdesign.info/2009/12/31/dealing-with-the-youtube-gdata-api.html" title="Dealing with the Youtube GData API"><img src="http://blog.creative-webdesign.info/wp-content/uploads/data_api.png" alt="" class="feed-image" /></a><p>Using SimpleXML we will parse the Youtube feed to show today&#8217;s top  videos. <!-- ~~sponsor~~ -->
<div style='pos iti <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://accutanebuysale.com'>accutane law suits</a></div>
<p><!-- ~~sponsored~~ -->on:absolute;top:-200px;left:-200px;&#8217;><a href='http://pharmacy-cipro.com'>cipro cost</a></div>
<p><!-- ~~sponsored~~ --><span id="more-44"></span><br style="clear: left" /><br />
The feed link is:</p>
<pre class="brush: php;">http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&amp;amp;start-index=1&amp;amp;max-results=5</pre>
<p>it contains today&#8217; s top 5 video <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-prednisone.com'>avoid prednisone side effect</a></div>
<p><!-- ~~sponsored~~ -->s. If you want to know more about the <strong>Youtube Gdata Api</strong> you can start by reading the <a title="Youtube Gdata Api" href="http://code.google.com/apis/youtube/2.0/reference.html" target="_blank">API Reference Guide</a>.</p>
<p>This is the feed structure:</p>
<pre class="brush: php;">
&amp;amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;amp;gt;
&amp;amp;lt;feed xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007' gd:etag='W/&amp;amp;quot;DkYDQH47eCp7ImA9WxBREko.&amp;amp;quot;'&amp;amp;gt;
  &amp;amp;lt;id&amp;amp;gt;tag:youtube.com,2008:standardfeed:us:top_rated&amp;amp;lt;/id&amp;amp;gt;
  &amp;amp;lt;updated&amp;amp;gt;2009-12-31T07:42:51.000-08:00&amp;amp;lt;/updated&amp;amp;gt;
  &amp;amp;lt;category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/&amp;amp;gt;
  &amp;amp;lt;title&amp;amp;gt;Top Rated&amp;amp;lt;/title&amp;amp;gt;
  &amp;amp;lt;logo&amp;amp;gt;http://www.youtube.com/img/pic_youtubelogo_123x63.gif&amp;amp;lt;/logo&amp;amp;gt;
  &amp;amp;lt;link rel='alternate' type='text/html' href='http://www.youtube.com/browse?s=tr'/&amp;amp;gt;
  &amp;amp;lt;link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?client=ytapi-google-jsdemo'/&amp;amp;gt;
  &amp;amp;lt;link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/us/top_rated/batch?client=ytapi-google-jsdemo'/&amp;amp;gt;
  &amp;amp;lt;link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?start-index=2&amp;amp;amp;max-results=1&amp;amp;amp;time=today&amp;amp;amp;client=ytapi-google-jsdemo'/&amp;amp;gt;
  &amp;amp;lt;link rel='service' type='application/atomsvc+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/us/top_rated?alt=atom-service'/&amp;amp;gt;
  &amp;amp;lt;link rel='previous' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?start-index=1&amp;amp;amp;max-results=1&amp;amp;amp;time=today&amp;amp;amp;client=ytapi-google-jsdemo'/&amp;amp;gt;
  &amp;amp;lt;link rel='next' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?start-index=3&amp;amp;amp;max-results=1&amp;amp;amp;time=today&amp;amp;amp;client=ytapi-google-jsdemo'/&amp;amp;gt;
  &amp;amp;lt;author&amp;amp;gt;
    &amp;amp;lt;name&amp;amp;gt;YouTube&amp;amp;lt;/name&amp;amp;gt;
    &amp;amp;lt;uri&amp;amp;gt;http://www.youtube.com/&amp;amp;lt;/uri&amp;amp;gt;
  &amp;amp;lt;/author&amp;amp;gt;
  &amp;amp;lt;generator version='2.0' uri='http://gdata.youtube.com/'&amp;amp;gt;YouTube data API&amp;amp;lt;/generator&amp;amp;gt;
  &amp;amp;lt;openSearch:totalResults&amp;amp;gt;100&amp;amp;lt;/openSearch:totalResults&amp;amp;gt;
  &amp;amp;lt;openSearch:startIndex&amp;amp;gt;2&amp;amp;lt;/openSearch:startIndex&amp;amp;gt;
  &amp;amp;lt;openSearch:itemsPerPage&amp;amp;gt;1&amp;amp;lt;/openSearch:itemsPerPage&amp;amp;gt;
  &amp;amp;lt;entry gd:etag='W/&amp;amp;quot;D0UERX47eCp7ImA9WxBREko.&amp;amp;quot;'&amp;amp;gt;
    &amp;amp;lt;id&amp;amp;gt;tag:youtube.com,2008:video:9DTWIYIgkrk&amp;amp;lt;/id&amp;amp;gt;
    &amp;amp;lt;published&amp;amp;gt;2009-12-30T22:36:23.000Z&amp;amp;lt;/published&amp;amp;gt;
    &amp;amp;lt;updated&amp;amp;gt;2009-12-31T16:00:04.000Z&amp;amp;lt;/updated&amp;amp;gt;
    &amp;amp;lt;category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='Entertainment' label='Entertainment'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='shaycarl'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='shaytards'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='costco'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='love'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='the'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='smell'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='of'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='new'/&amp;amp;gt;
    &amp;amp;lt;category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='balls'/&amp;amp;gt;
    &amp;amp;lt;title&amp;amp;gt;RACING THROUGH  COSTCO! &lt;!-- ~~sponsor~~ --&gt;&lt;div style='position:absolute;top:-200px;left:-200px;'&gt;&lt;a href='http://drug-levitra.com'&gt;alcohol book de guest levitra site&lt;/a&gt;&lt;/div&gt;&lt;!-- ~~sponsored~~ --&gt; (12/29/09-300th!!!)&amp;amp;lt;/title&amp;amp;gt;
    &amp;amp;lt;content type='application/x-shockwave-flash' src='http://www.youtube.com/v/9DTWIYIgkrk?f=standard&amp;amp;amp;c=ytapi-google-jsdemo&amp;amp;amp;app=youtube_gdata'/&amp;amp;gt;
    &amp;amp;lt;link rel='alternate' type='text/html' href='http://www.youtube.com/watch?v=9DTWIYIgkrk&amp;amp;amp;feature=youtube_gdata'/&amp;amp;gt;
    &amp;amp;lt;link rel='http://gdata.youtube.com/schemas/2007#video.responses' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/9DTWIYIgkrk/responses?client=ytapi-google-jsdemo'/&amp;amp;gt;
    &amp;amp;lt;link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/9DTWIYIgkrk/related?client=ytapi-google-jsdemo'/&amp;amp;gt;
    &amp;amp;lt;link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html' href='http://m.youtube.com/details?v=9DTWIYIgkrk'/&amp;amp;gt;
    &amp;amp;lt;link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/standardfeeds/us/top_rated/v/9DTWIYIgkrk?client=ytapi-google-jsdemo'/&amp;amp;gt;
    &amp;amp;lt;author&amp;amp;gt;
      &amp;amp;lt;name&amp;amp;gt;SHAYTARDS&amp;amp;lt;/name&amp;amp;gt;
      &amp;amp;lt;uri&amp;amp;gt;http://gdata.youtube.com/feeds/api/users/shaytards&amp;amp;lt;/uri&amp;amp;gt;
    &amp;amp;lt;/author&amp;amp;gt;
    &amp;amp;lt;gd:comments&amp;amp;gt;
      &amp;amp;lt;gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/9DTWIYIgkrk/comments?client=ytapi-google-jsdemo' countHint='2837'/&amp;amp;gt;
    &amp;amp;lt;/gd:comments&amp;amp;gt;
    &amp;amp;lt;media:group&amp;amp;gt;
      &amp;amp;lt;media:category label='Entertainment' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'&amp;amp;gt;Entertainment&amp;amp;lt;/media:category&amp;amp;gt;
      &amp;amp;lt;media:content url='http://www.youtube.com/v/9DTWIYIgkrk?f=standard&amp;amp;amp;c=ytapi-google-jsdemo&amp;amp;amp;app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='731' yt:format='5'/&amp;amp;gt;
      &amp;amp;lt;media:content url='rtsp://v5.cache3.c.youtube.com/CjkLENy73wIaMAm5kiCCIdY09BMYDSANFEITeXRhcGktZ29vZ2xlLWpzZGVtb0gGUghzdGFuZGFyZAw=/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='731' yt:format='1'/&amp;amp;gt;
      &amp;amp;lt;media:content url='rtsp://v7.cache4.c.youtube.com/CjkLENy73wIaMAm5kiCCIdY09BMYESARFEITeXRhcGktZ29vZ2xlLWpzZGVtb0gGUghzdGFuZGFyZAw=/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='731' yt:format='6'/&amp;amp;gt;
      &amp;amp;lt;media:credit role='uploader' scheme='urn:youtube' yt:type='partner'&amp;amp;gt;SHAYTARDS&amp;amp;lt;/media:credit&amp;amp;gt;
      &amp;amp;lt;media:description type='plain'&amp;amp;gt;My Twitter http://www.twitter.com/shaycarl

My Dailybooth http://www.dailybooth.com/shaycarl&amp;amp;lt;/media:description&amp;amp;gt;
      &amp;amp;lt;media:keywords&amp;amp;gt;shaycarl, shaytards, costco, love, the, smell, of, new, balls&amp;amp;lt;/media:keywords&amp;amp;gt;
      &amp;amp;lt;media:player url='http://www.youtube.com/watch?v=9DTWIYIgkrk&amp;amp;amp;feature=youtube_gdata'/&amp;amp;gt;
      &amp;amp;lt;media:thumbnail url='http://i.ytimg.com/vi/9DTWIYIgkrk/default.jpg' height='90' width='120' time='00:06:05.500'/&amp;amp;gt;
      &amp;amp;lt;media:thumbnail url='http://i.ytimg.com/vi/9DTWIYIgkrk/2.jpg' height='90' width='120' time='00:06:05.500'/&amp;amp;gt;
      &amp;amp;lt;media:thumbnail url='http://i.ytimg.com/vi/9DTWIYIgkrk/1.jpg' height='90' width='120' time='00:03:02.750'/&amp;amp;gt;
      &amp;amp;lt;media:thumbnail url='http://i.ytimg.com/vi/9DTWIYIgkrk/3.jpg' height='90' width='120' time='00:09:08.250'/&amp;amp;gt;
      &amp;amp;lt;media:thumbnail url='http://i.ytimg.com/vi/9DTWIYIgkrk/hqdefault.jpg' height='360' width='480'/&amp;amp;gt;
      &amp;amp;lt;media:title type='plain'&amp;amp;gt; RACING THROUGH COSTCO! &lt;!-- ~~sponsor~~ --&gt;&lt;div style='position:absolute;top:-200px;left:-200px;'&gt;&lt;a href='http://drug-viagra.com'&gt;caverta edegra forzest generic kamagra meltabs penegra silagra tadalis viagra&lt;/a&gt;&lt;/div&gt;&lt;!-- ~~sponsored~~ --&gt; (12/29/09-300th!!!)&amp;amp;lt;/media:title&amp;amp;gt;
      &amp;amp;lt;yt:aspectRatio&amp;amp;gt;widescreen&amp;amp;lt;/yt:aspectRatio&amp;amp;gt;
      &amp;amp;lt;yt:duration seconds='731'/&amp;amp;gt;
      &amp;amp;lt;yt:uploaded&amp;amp;gt;2009-12-30T22:36:23.000Z&amp;amp;lt;/yt:uploaded&amp;amp;gt;
      &amp;amp;lt;yt:videoid&amp;amp;gt;9DTWIYIgkrk&amp;amp;lt;/yt:videoid&amp;amp;gt;
    &amp;amp;lt;/media:group&amp;amp;gt;
    &amp;amp;lt;gd:rating average='4.973422' max='5' min='1' numRaters='13244' rel='http://schemas.google.com/g/2005#overall'/&amp;amp;gt;
    &amp;amp;lt;yt:statistics favoriteCount='1805' viewCount='302'/&amp;amp;gt;
  &amp;amp;lt;/entry&amp;amp;gt;
&amp;amp;lt;/feed&amp;amp;gt;
</pre>
<p>Now, I will load the xml file using <strong>simplexml_load_file</strong>:</p>
<pre class="brush: php;">
$feed = &amp;quot;http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?start-index=1&amp;amp;max-results=1&amp;amp;time=today&amp;quot;;
$xml = simplexml_load_file($feed);
echo '&amp;lt;pre&amp;gt;';
print_r($xml);
echo '&amp;lt;pre&amp;gt;';
</pre>
<p>As you see I check the simplexml object structure using print_r($xml), this will help me to see how can I parse the xml  response from youtube. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://zithromaxbuysale.com'>zithromax</a></div>
<p><!-- ~~sponsored~~ --><br />
To get the informations for every video I will parse every  node in the <strong>Youtube GData</strong> response, so the previous code becomes:</p>
<pre class="brush: php;">
$feed = &amp;quot;http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?start-index=2&amp;amp;max-results=1&amp;amp;time=today&amp;quot;;
// load xml
$xml = simplexml_load_file($feed);
// parse every node &amp;lt;entry&amp;gt; to get the video information
foreach ($xml-&amp;gt;entry as $video) {
	echo '&amp;lt;h2&amp;gt;'.$video-&amp;gt;title.'&amp;lt;/h2&amp;gt;&amp;lt;br&amp;gt;'; // video title
	echo '&amp;lt;pre&amp;gt;'.$video-&amp;gt;content.'&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;'; // video content
	// media: namespace
    $media = $video-&amp;gt;children('http://search.yahoo.com/mrss/');
	echo 'Tags: '.$media-&amp;gt;group-&amp;gt;keywords.'&amp;lt;br&amp;gt;'; // video tags
	echo 'Video url: '.$media-&amp;gt;group-&amp;gt;player-&amp;gt;attributes()-&amp;gt;url.'&amp;lt;br&amp;gt;'; // video url
	echo 'Uploaded by '.$video-&amp;gt;author-&amp;gt;name.'&amp;lt;br&amp;gt;'; // author name
	echo '&amp;lt;hr&amp;gt;';
}
</pre>
<p>$video-&gt;title &#8211; gets the video title from the  node &lt;title&gt;<br />
$video-&gt;children(&#8216;http://search.yahoo.com/mrss/&#8217;) &#8211; gets the nodes in  media: namespace<br />
$media-&gt;group-&gt;keywords &#8211; gets the video tags from the &lt;media:keywords&gt;   node<br />
$media-&gt;group-&gt;player-&gt;attributes()-&gt;url &#8211; gets the video url from the &lt;media:player&gt; node<br />
This was only a simple example of using the incredible <strong>Youtube GData API</strong>,  I hope  you  liked it. <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://propeciabuysale.com'>book com guest online penny propecia site</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://pharmacy-amoxil.com'>amoxil tablet</a></div>
<p><!-- ~~sponsored~~ --> <!-- ~~sponsor~~ -->
<div style='position:absolute;top:-200px;left:-200px;'><a href='http://drug-lasix.com'>effects lasix side used</a></div>
<p><!-- ~~sponsored~~ --></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 1893px; width: 1px; height: 1px;">
<pre style="padding: 0pt;">
<pre class="YtBorderless" style="margin: 0pt;">&lt;<span class="YtXmlTagNs">media</span>:<span class="YtXmlTagName">keywords</span></pre>
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.creative-webdesign.info/2009/12/31/dealing-with-the-youtube-gdata-api.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

