Script doesnt work

@Dersarius like @DallasNChains is trying tell you, no one here just wants to hand out answers repeatedly. If you copy and paste code but never learn what’s it actually does you will continue to copy and paste forever, and never learn.

If you can understand what the original code you posted does… then you should be able to easily understand how to add a function and make it work.

<?php

// set the value $url to the api page/call you want to make
$url = ‘https://api.twitch.tv/kraken/users/gronkh’;

// append the URL set above to the built-in function called “file_get_contents” and use this function to download that page/data
$json = file_get_contents($url);

// run(parse) the downloaded contents through the json_decoder to make it human readable, store it as an array called data
$data = json_decode($json, true);

// store the “bio” field from the array to the variable $bio
$bio = $data[‘bio’];

// echo the value of $bio
echo “bio: $bio”;
?>