How to embed last video to my channel in my website

Hello everybody,

I need to know how to embed last video to my channel in my website with php code.

I am new in the code and I would like to make a page with all the old broadcasts of my chain and if possible put a player above to play the video Chosen

I am sorry not to have a code to offer you but I do not understand too much about the twitch code :frowning:

Thanks a lot for your helpness.

bye

        <?php
        $curl = curl_init('https://api.twitch.tv/kraken/channels/CHANNELNAME/videos');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($curl);
        $i = curl_getinfo($curl);
        curl_close($curl);
        $videos = json_decode($result);

Then

<iframe 
    src="http://player.twitch.tv/?video=<?php echo $videos->videos[0]->_id; ?>" 
    height="720" 
    width="1280" 
    frameborder="0" 
    scrolling="no"
    allowfullscreen="true">
</iframe>

thanks for your reply.
But when i use the first code he does not work, why? i don’t know.
I use wordpress to take my website.
The player it’s okay.

Thanks a lot :wink:

I’m not going to do all the development work for you…

You’d either need a plugin that lets you use PHP in Posts/pages or write a plugin to allow your code to operate.

sorry bro, but i don’t understand why doesn’t work…
i work with your code and i say what :wink:

You did swap out CHANNELNAME for the name of your channel right…

yes

Turn on CURL_VERBOSE and debug the response.

It is possible your Hosting provider has a SSL problem

ok i try

my code for wordpress
[insert_php]
$curl = curl_init(‘https://api.twitch.tv/kraken/channels/bigbangs06/videos’);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
$i = curl_getinfo($curl);
curl_close($curl);
$videos = json_decode($result);
[/insert_php]
i see nothing

You forgot:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.