Fatal error: Call to a member function getVideoEntry() on a

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Fatal error: Call to a member function getVideoEntry() on a

Re: Fatal error: Call to a member function getVideoEntry() o

par mike56 » 30 déc. 2012, 11:51

Bonjour momox,

j'ai toujours le même bug malgré avoir placé les deux id.
je vais regarder de la classe qui manque........

Re: Fatal error: Call to a member function getVideoEntry() o

par mike56 » 29 déc. 2012, 23:52

voilà ce que j'y ai trouvé
setHttpClient (line 221)
Set the Zend_Http_Client object used for communication

return: Provides a fluent interface
throws: Zend_Gdata_App_HttpException
access: public
Zend_Gdata_App setHttpClient (Zend_Http_Client $client, [ $applicationId = 'MyCompany-MyApp-1.0'], [ $clientId = null], [ $developerKey = null])
Zend_Http_Client $client: The client to use for communication
$applicationId
$clientId
$developerKey
Redefinition of:
Zend_Gdata_App::setHttpClient()
Set the Zend_Http_Client object used for communication
je vais d'abord faire en sorte d'obtenir ce qu'il manque:
$applicationId
 $clientId

Re: Fatal error: Call to a member function getVideoEntry() o

par momox » 29 déc. 2012, 23:17

A priori, c'est surtout ton $httpClient qui pose problème si je me fie tel quel aux messages d'erreur.

Pour la doc concernant Zend_Gdata_Youtube, regarde sur http://framework.zend.com/apidoc/1.7/Ze ... uTube.html

Re: Fatal error: Call to a member function getVideoEntry() o

par mike56 » 29 déc. 2012, 22:46

bonsoir momox,

pour moi, le code est bon, l'erreur est sans doute dû à un problème d'authentification.
$applicationId = '????????';
$clientId = '??????????????';
$developerKey = 'AI39si7KdFT8_t4qYHnKViZY5tZ8k2mtumWf6YdGfl3chqEOIkNfBb_jHtb45yYx0PAnf_162kOgQJXVZof4Mi6rn4wXHeCU9g';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$commentFeed = $yt->getVideoCommentFeed('QQoFLrZ5C3M');
Le hic, c'est que je ne sais pas où trouver applicationid, clientid........par contre le developperkey, je l'ai.

Les deux autres id ne sont pas les miens, j'avais C/C le code sur le site en question.

si tu peux m'aider en me donnant le chemin à suivre, je cherche depuis 48 h sur google api console
sans succès.

Merci momox.

Re: Fatal error: Call to a member function getVideoEntry() o

par momox » 29 déc. 2012, 21:26

Ton exception levée est la suivante:
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Argument is not an instance of Zend_Http_Client.' in /htdocs/public/www/Zend/Gdata/YouTube.php:231 Stack trace: #0 /htdocs/public/www/Zend/Gdata/YouTube.php(212): Zend_Gdata_YouTube->setHttpClient(Object(__PHP_Incomplete_Class), '675765237623', '987348763498537...', 'AI39si7KdFT8_t4...') #1 /htdocs/public/www/tests.php(116): Zend_Gdata_YouTube->__construct(Object(__PHP_Incomplete_Class), '675765237623', '987348763498537...', 'AI39si7KdFT8_t4...') #2 {main} thrown in /htdocs/public/www/Zend/Gdata/YouTube.php on line 231
Gardons ce qui nous intéresse:
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Argument is not an instance of Zend_Http_Client.'
D'après ce message, une de tes classes attend en paramètre une classe qui hérite de Zend_Http_Client et tu lui donnes autres chose.
Vérifie tes instanciations.

Re: Fatal error: Call to a member function getVideoEntry() o

par mike56 » 29 déc. 2012, 17:34

Bonjour Momox, peux tu m'aiguiller ?

Merci.

Re: Fatal error: Call to a member function getVideoEntry() o

par momox » 29 déc. 2012, 17:21

Regarde l'exception qui a été levée (et non attrapée), cela devrait déjà t'avancer.

Fatal error: Call to a member function getVideoEntry() on a

par Mike56 » 28 déc. 2012, 21:52

Bonsoir,

j'ai installé à la racine de mon site ZendFrameWork, ensuite, j'ai crée cette page test qui doit me permettre
de lire les derniers commentaires d'une vidéo de youtube tout en pouvant y répondre.

j'ai donc mis le code suivant à cette page: lien
<?php

// start a new session 
session_start();



// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    // realpath(APPLICATION_PATH . '/../library'),
    realpath('../common/zend/library'),
    get_include_path(),
)));

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

//AuthSub Functions
function getAuthSubRequestUrl()
{
    $next = 'http://www.businessbourse.com/tests.php'; // I have modified this for the sake of this question - it actually has a real url here normally
    $scope = 'http://gdata.youtube.com';
    $secure = false;
    $session = true;
    return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}

function getAuthSubHttpClient()
{
    if (!isset($_GET['token']) ){
        echo '<a href="' . getAuthSubRequestUrl() . '">Login!</a>';
        return;
    } else if (isset($_GET['token'])) {
      $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
    }

    $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
    return $httpClient;
}

// Comment stuff

if($httpClient != '' && isset($_POST['btn_submit']))
{
    $comment = $_POST['comment'];

    $videoEntry = $yt->getVideoEntry('QQoFLrZ5C3M');
    $newComment = $yt->newCommentEntry();
    $newComment->content = $yt->newContent()->setText($comment);

    // post the comment to the comments feed URL for the video
    $commentFeedPostUrl = $videoEntry->getVideoCommentFeedUrl();
    $updatedVideoEntry = $yt->insertEntry($newComment, $commentFeedPostUrl,
      'Zend_Gdata_YouTube_CommentEntry');
}

// End Comment Stuff

?>

<!DOCTYPE HTML>
<head>
    <title>UStream Test</title>
    <style>
        .comment {
            background-color: red;
            height: 100px;
            width: 500px;
            color: white;
            font-weight: bold;
        }
    </style>
</head>
<body>
<div id="wrap">
<div id="authsub">

    <?php
        if($httpClient == '' && !isset($_GET['token'])) 
        { ?>
            <a href="<?=getAuthSubRequestUrl()?>">Authenticate</a><?php 
        } 
        elseif(!isset($_SESSION['sessionToken']) && isset($_GET['token'])) 
        {
            $httpClient = getAuthSubHttpClient();
            $_SESSION['httpClient'] = $httpClient;
        }
        else
        {
            $httpClient = $_SESSION['httpClient'];
            echo 'You are authenticated!';
        }

        // if($httpClient == '') $httpClient = getAuthSubHttpClient();
        // if($httpClient == '') echo '<br />empty'; else echo '<br />not empty';

    ?>

</div><br /><br /><br /><br /><br />

<?php

/*********Creates YouTube Instance***********/

    $applicationId = '675765237623';
    $clientId = '9873487634985374570t70';
    $developerKey = 'AI39si7KdFT8_t4qYHnKViZY5tZ8k2mtumWf6YdGfl3chqEOIkNfBb_jHtb45yYx0PAnf_162kOgQJXVZof4Mi6rn4wXHeCU9g';
    $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
    $commentFeed = $yt->getVideoCommentFeed('QQoFLrZ5C3M');
/********************************************/
?>
 <div id="comment_form">
    <form action="http://www.businessbourse.com/tests.php" method="post">
        <input type="text" name="comment" placeholder="Enter your comment" />
        <input type="submit" name="btn_submit" />
    </form>
 </div>

<?php
foreach ($commentFeed as $commentEntry) {
    echo '<div class="comment">';
    echo $commentEntry->title->text . "\n";
    echo $commentEntry->content->text . "\n\n\n";
    echo '</div><br />';
}

?>
</div>
</body>
Le souci c'est qu'une fois m'être identifié et avoir posté mon commentaire, j'ai ce message d'erreur :
Fatal error: Call to a member function getVideoEntry() on a non-object in /htdocs/public/www/tests.php on line 55
et si je reviens à la page précédente, je trouce ceci:
You are authenticated!


Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Argument is not an instance of Zend_Http_Client.' in /htdocs/public/www/Zend/Gdata/YouTube.php:231 Stack trace: #0 /htdocs/public/www/Zend/Gdata/YouTube.php(212): Zend_Gdata_YouTube->setHttpClient(Object(__PHP_Incomplete_Class), '675765237623', '987348763498537...', 'AI39si7KdFT8_t4...') #1 /htdocs/public/www/tests.php(116): Zend_Gdata_YouTube->__construct(Object(__PHP_Incomplete_Class), '675765237623', '987348763498537...', 'AI39si7KdFT8_t4...') #2 {main} thrown in /htdocs/public/www/Zend/Gdata/YouTube.php on line 231

je précise que ce code a été pris ici: lien2

Si quelqu'un peut m'aider ?

Merci.