Así como esta este código me muestra todas las posiciones y solo necesito 0 y 1.
Código PHP:
foreach($datos->data->items as $index => $objecto)
{
print $objecto->video->id; //esto es lo que buscas
echo'<br>';
}
Código PHP:
query results:stdClass Object
(
[apiVersion] => 2.1
[data] => stdClass Object
(
[totalItems] => 6
[startIndex] => 1
[itemsPerPage] => 25
[items] => Array
(
[0] => stdClass Object
(
[id] => FLteUm5PjyKIBcEkV5qsk1tOa18pwaJWAf
[created] => 2013-06-20T01:07:59.000Z
[author] => La Fuente
[video] => stdClass Object
(
[id] => 8EFMojiDY2k
[uploaded] => 2011-10-06T17:07:35.000Z
[updated] => 2013-06-20T06:21:33.000Z
[uploader] => pabloalboranvevo
[category] => Music
[title] => Pablo Alborán - Perdóname (con Carminho)
[description] => Music video by Pablo Alborán performing Perdóname (con Carminho). (P) 2011 Trimeca Estudios y Producciones S.L. Bajo licencia exclusiva a EMI Music Spain S.A.
[thumbnail] => stdClass Object
(
[sqDefault] => https://i1.ytimg.com/vi/8EFMojiDY2k/default.jpg
[hqDefault] => https://i1.ytimg.com/vi/8EFMojiDY2k/hqdefault.jpg
)
[player] => stdClass Object
(
[default] => https://www.youtube.com/watch?v=8EFMojiDY2k&feature=youtube_gdata_player
)
[content] => stdClass Object
(
[5] => https://www.youtube.com/v/8EFMojiDY2k?version=3&f=favorite&app=youtube_gdata
)
[duration] => 256
[aspectRatio] => widescreen
[rating] => 4.915737
[likeCount] => 38617
[ratingCount] => 39448
[viewCount] => 11490242
[favoriteCount] => 0
[commentCount] => 3083
[status] => stdClass Object
(
[value] => restricted
[reason] => requesterRegion
)
[restrictions] => Array
(
[0] => stdClass Object
(
[type] => country
[relationship] => allow
[countries] => SA MC DK LR LU LT DO LV LY LA LC DZ LI LK WS GP GQ GR GS GT GU GW GY GA GB GD GE GF GG GH GI GM GN TZ TR TT TW TV TH TK TJ TM OM TO TN TC TD TG TF MV RU KI MN FM SL SM SN SO SH NR SJ NP SD SE SG NZ SB SC NG NF NE NC SY SZ WF ST SV NL FR NI TL AW AT AU AR AS AQ YE AZ LS AX AG AD AE DM AL AM SK AI FJ VU QA IR IS IQ IN IO IL IM VI US VG ID IE VC FI AO YT UZ UY HU HT HR HM LB HK UM ZM UA UG CX CY CZ CU CV EH CR CL CM CN CO CH CI CK CD RO CF CG CC PE KE PG PF PA PL KN PN KH PH PK PT PW KW KP KR PR PY KY KZ BZ BY BS BR BW BV KM BT BJ BI BH BO BN BL BB BA BG BF BE NA JE VN HN JO JM JP BD ER MG FO NU DJ SR FK NO VE SI MR MS MP MQ ZW MW MT MU MZ EC MX MY EG RE EE IT ZA MA MF ET MD ME RS ES MH RW MO ML
)
)
[accessControl] => stdClass Object
(
[comment] => allowed
[commentVote] => allowed
[videoRespond] => allowed
[rate] => allowed
[embed] => allowed[list] => allowed
[autoPlay] => denied
[syndicate] => allowed
)
)
)
[1] => stdClass Object
(
[id] => FLteUm5PjyKIAO6mL7Zlgk4KUVj2TyriX4
[created] => 2013-06-15T08:00:00.000Z
[author] => La Fuente
[video] => stdClass Object
(
[id] => j0h2u87JwyA
[uploaded] => 2012-07-16T17:12:32.000Z
[updated] => 2013-06-20T06:44:39.000Z
[uploader] => itsmadeon
[category] => Music
[title] => Madeon - Finale
[description] => FINALE
Out everywhere 22nd of July.
Pre-order/iTunes : http://smarturl.it/madeonfinale
Featuring vocals by Nicholas Petricca from Walk The Moon.
[thumbnail] => stdClass Object
(
[sqDefault] => https://i3.ytimg.com/vi/j0h2u87JwyA/default.jpg
[hqDefault] => https://i3.ytimg.com/vi/j0h2u87JwyA/hqdefault.jpg
)
[player] => stdClass Object
(
[default] => https://www.youtube.com/watch?v=j0h2u87JwyA&feature=youtube_gdata_player
[mobile] => https://m.youtube.com/details?v=j0h2u87JwyA
)
[content] => stdClass Object
(
[5] => https://www.youtube.com/v/j0h2u87JwyA?version=3&f=favorite&app=youtube_gdata
)
[duration] => 204
[aspectRatio] => widescreen
[rating] => 4.955413
[likeCount] => 50832
[ratingCount] => 51405
[viewCount] => 4712496
[favoriteCount] => 0
[commentCount] => 15865
[status] => stdClass Object
(
[value] => restricted
[reason] => requesterRegion
)
[restrictions] => Array
(
[0] => stdClass Object
(
[type] => country
[relationship] => deny
[countries] => DE
)
)
[accessControl] => stdClass Object
(
[comment] => allowed
[commentVote] => allowed
[videoRespond] => moderated
[rate] => allowed
[embed] => allowed[list] => allowed
[autoPlay] => allowed
[syndicate] => allowed
)
)
)