
Originariamente inviata da
Altari0
Salve volevo fare una richiesta con le api di youtube ma il php mi interpreta nell'ultima riga
'yt$channelStatistics' come la variabile $channelStatistics (inesistente, perchè è il nome di un tag xml) preceduto da yt quindi l'output sarà
yt
con conseguenza che non trova il tag...
ecco il codice
Codice PHP:
<?php
$user = $_GET['user'];
$json = file_get_contents("http://gdata.youtube.com/feeds/api/users/".$user."?alt=json");
$data = json_decode($json, true);
echo $data['entry']['yt$channelStatistics']['subscriberCount'] . '</br>';
?>
Grazie in anticipo