PHP: JSON Api Tenor

how can i get all url-s from https://api.tenor.com/v1/trending?key=LIVDSRZULELA&limit=8 (results->media->nanomp4->url)

if($json = cURLGetContents("https://api.tenor.com/v1/trending?key=LIVDSRZULELA&limit=8")) {
    $obj = json_decode($json);
    echo $obj->results->{"media"}->{"nanomp4"}->{"url"};
}

Function cURLGetContents($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}


Source: stackoverflow-php

Leave a Reply

Your email address will not be published. Required fields are marked *