php - Users can Upload video on single Youtube Channel with or without authentication -


i making program upload video youtube channel user. generates error. code follows:-

   require_once 'zend/loader.php';    zend_loader::loadclass('zend_gdata_youtube');    zend_loader::loadclass('zend_gdata_authsub');    zend_loader::loadclass('zend_gdata_app_exception');     zend_loader::loadclass('zend_gdata_clientlogin');     $authenticationurl= 'https://www.google.com/accounts/clientlogin';     $client = "";      $email = 'theprofessional1992@gmail.com';    $passwd = '*******************';     try {       $client = zend_gdata_clientlogin::gethttpclient($email, $passwd, 'cl');     } catch (zend_gdata_app_captcharequiredexception $cre) {  echo 'url of captcha image: ' . $cre->getcaptchaurl() . "\n"; echo 'token id: ' . $cre->getcaptchatoken() . "\n";   } catch (zend_gdata_app_authexception $ae) {  echo 'problem authenticating: ' . $ae->exception() . "\n";  } 

error :- notice: undefined offset: 1 in c:\wamp\www\yt\zdata\demos\zend\gdata\youtubevideoapp\zend\gdata\clientlogin.php on line 150

even don't know how functionality made.

please ?

note: youtube data api (v2) has been officially deprecated of march 4, 2014

with youtube data api (v3) can not upload using username , password.
if want upload video youtube, have use these libs:
https://github.com/google/google-api-php-client
https://github.com/youtube/api-samples/tree/master/php
https://github.com/youtube/api-samples/blob/master/php/resumable_upload.php

of course if don't want authentication each upload process can use refresh token.

$client = new google_client(); $client->setclientid($oauth2_client_id); $client->setclientsecret($oauth2_client_secret); $client->setscopes('https://www.googleapis.com/oauth2/v3/token'); $client->setaccesstype('offline'); 

an refresh token include in api response. save database. remember can refresh token @ first time. if lose have revoke application https://security.google.com/settings/security/permissions?pli=1

now refresh token can access token anytime automatically:

$client->refreshtoken($refreshtoken); $accesstoken = $client->getaccesstoken(); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -