im trying to do this: load http://example.com/nickname/picture (nickname is loaded as a var in the url you visit, that´s working) decode to json the site is this
{
"picture": "https://example.com/hf8329yrh8oq.jpg"
}
load the picture what i tried:
function curlGet($url)
{
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$status = curl_exec($crl);
curl_close($crl);
return $status;
}
$profPicCurl = curlGet('https://example.com/'.urlencode($_GET['nickname']).'/picture')
$profPic = json_decode($profPicCurl,true);
echo file_get_contents($profPic.["picture"]);
i know I didn´t handle errors and stuff in this script, but i want it to work with a real image first before.
so the mean question: how to display and image from a decoded json site?