Quote Originariamente inviata da Altari0 Visualizza il messaggio
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($jsontrue);
echo  
$data['entry']['yt$channelStatistics']['subscriberCount'] . '</br>';
?>
Grazie in anticipo
Ciao.
Prova a riscrivere il tuo codice così:


Codice PHP:

<?php 

$user 
$_GET['user'];

$json file_get_contents("http://gdata.youtube.com/feeds/api/users/".$user."?alt=json");

$data json_decode($jsontrue);

$variabilecondollaro 'yt$channelStatistics';

echo  
$data['entry'][$variabilecondollaro]['subscriberCount'] . '</br>';

?>