Youtube API PHP sorun

1 Cevap php

i am using a youtube api php and have problem... OS: debian, php 5.2

<?php
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');

    $yt = new Zend_Gdata_YouTube();
    $query = $yt->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);

    $feed = $yt->getVideoFeed($query);

    echo '<pre>';
    print_r($yt);

Bu kod boş dönüş, ancak bir sonraki kodu ..

<?php
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');

    $yt = new Zend_Gdata_YouTube();
    /*$query = $yt->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);

    $feed = $yt->getVideoFeed($query);*/

    echo '<pre>';
    print_r($yt);

nesneyi geri döndü ...

Zend_Gdata_YouTube Object
(
    [_defaultPostUri:protected] => 
    [_registeredPackages:protected] => Array
        (
            [0] => Zend_Gdata_Media_Extension
            [1] => Zend_Gdata_Media
            [2] => Zend_Gdata_YouTube_Extension
            [3] => Zend_Gdata_YouTube
            [4] => Zend_Gdata_Kind
            [5] => Zend_Gdata_Extension
            [6] => Zend_Gdata
            [7] => Zend_Gdata_App_Extension
            [8] => Zend_Gdata_App
        )

    [_httpClient:protected] => Zend_Http_Client Object
        (
            [config:protected] => Array
                (
                    [maxredirects] => 5
                    [strictredirects] => 1
                    [useragent] => Zend_Http_Client
                    [timeout] => 10
                    [adapter] => Zend_Http_Client_Adapter_Socket
                    [httpversion] => 1.1
                    [keepalive] => 
                    [storeresponse] => 1
                    [strict] => 1
                    [output_stream] => 
                )

            [adapter:protected] => 
            [uri:protected] => 
            [headers:protected] => Array
                (
                    [user-agent] => Array
                        (
                            [0] => User-Agent
                            [1] => MyCompany-MyApp-1.0 Zend_Framework_Gdata/1.10.0
                        )

                )

            [method:protected] => GET
            [paramsGet:protected] => Array
                (
                )

            [paramsPost:protected] => Array
                (
                )

            [enctype:protected] => 
            [raw_post_data:protected] => 
            [auth:protected] => 
            [files:protected] => Array
                (
                )

            [cookiejar:protected] => 
            [last_request:protected] => 
            [last_response:protected] => 
            [redirectCounter:protected] => 0
        )

    [_majorProtocolVersion:protected] => 
    [_minorProtocolVersion:protected] => 
    [_useObjectMapping:protected] => 1
)

Why? Where a problem? Sorry for bah english

1 Cevap

.........

    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');

    $yt = new Zend_Gdata_YouTube();
    $query = $yt->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);

    $feed = $yt->getVideoFeed($query);

    echo '<pre>';
    print_r($yt);

Yerine $yt, sen var ne görmek $feed örneğin:

    echo '<pre>';
    print_r($feed);

nesneyi geri döndü ...

Eğer bir nesne üzerinde örneğin print_r kullanılarak olmasıdır:

$yt = new Zend_Gdata_YouTube();