Youtube API Standard feeds On Website?

Started on the old forum in January 2012 · view the original in the archive · old links redirect here

#get-request #php #standard-feeds #youtube-api

2 replies · 736 views · started 14 years ago · 1 min read

3 participants
railroadman Newbie · 1 posts #1

Hi there,

I'm wondering If anyone can assist me. I am currently a design student In Leeds, UK.

I'm create a online campaign whereby customers use QR codes to link to a created website with interesting youtube video on.

At the moment I've just created a simple link to the chosen content

Website version 1

However I've come across Youtube API Standard feeds on the Youtube Reference Guide. Reference Guide: Data API Protocol - YouTube APIs and Tools - Google Code

It states you can 'send a GET request to the URL associated with that feed', however, I've never really touched php before. Could anyone give me advise on how I would link this feed to my site? Would that be difficult?

Many replies would be much appreciated!

Regards

David.

GumSlone Administrator Principal · 1,690 posts #2

hi,

which informations would you like to grab from youtube api?

video description, tags, keywords title, views etc?

or

a list with related videos/top videos/ recently added videos or a playlist?

Added after 7 minutes:

to send a get request with php is simple, you can use curl or other methods:

<?php
$url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_popular'; /* youtube feed url with most popular videos */
	
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
$feed_content = curl_exec($ch);
curl_close($ch);

echo $feed_content; // show the feed output

?>

or like this:

<?php
$url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_popular'; /* youtube feed url with most popular videos */
$feed_content = file_get_contents($url);
echo $feed_content; // show the feed output
?>

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

warfrek Junior · 44 posts #3

This post gave me some idea. Thanks gumslone. Such a genius guy.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close