コード例 #1
0
ファイル: functions.php プロジェクト: danielheyman/EazySubs
function comment($entry, $comment)
{
    $username = $_SESSION['username'];
    $query = "select token from user where username='******'";
    $result = mysql_query($query);
    $row = mysql_fetch_array($result);
    $token = $row['token'];
    $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
    $developerKey = 'AI39si5uCFW5FETweIaPnbNJUP88YvpOtSoy7FSUnYnTFVH4liFKzqWTkndATtgiltByN54tPcVjsScyh3S28P-D4PC4n73alg';
    $applicationId = 'EazySubs';
    $clientId = 'EazySubs';
    $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
    try {
        $videoEntry = $yt->getVideoEntry($entry);
        $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');
        return true;
    } catch (Exception $e) {
        return false;
    }
}