php - Upload video youtube by Gdata Authentication with Google failed. Reason: BadAuthentication -


i used upload video code:

    try {     $ytconfigdata = app_sitesettings::get('yt');     $httpclient = zend_gdata_clientlogin::gethttpclient($ytconfigdata->user,$ytconfigdata->password, 'youtube'); } catch (zend_gdata_app_captcharequiredexception $cre) {     echo 'url of captcha image: ' . $cre->getcaptchaurl() . "\n";     echo 'token id: ' . $cre->getcaptchatoken() . "\n";     exit; } catch (zend_gdata_app_authexception $ae) {     echo 'problem authenticating: ' . $ae->exception() . "\n";     exit; } $yt = new zend_gdata_youtube($httpclient,                                  null,//$applicationid,                                  null,//$clientid,                                  $ytconfigdata->devkey); $myvideoentry= new zend_gdata_youtube_videoentry() 

now authentication google failed. reason: badauthentication

i've not enabled 2-step verification on gmail account

i've tried https://code.google.com/p/google-api-php-client/ there example show uploads video no example how load video :( can give me how can upload video on youtube script ? in advance.

sorry after day script works again don't know why :( news in case stop working again i've fallback :) https://code.google.com/p/google-api-php-client/ post in case

$client = new google_client(); $client->setclientid($oauth2_client_id); $client->setclientsecret($oauth2_client_secret); $redirect = filter_var('https://' . $_server['http_host'] . $_server['php_self'],   filter_sanitize_url);  $client->setredirecturi($redirect);  $youtube = new google_youtubeservice($client);   if (isset($_get['code'])) {   if (strval($_session['state']) !== strval($_get['state'])) {     die('the session state did not match.');   }    $client->authenticate();   $_session['token'] = $client->getaccesstoken();   header('location: ' . $redirect); }  if (isset($_session['token'])) {   $client->setaccesstoken($_session['token']); }  echo $_session['token'];  if ($client->getaccesstoken()) {   try {     $snippet = new google_videosnippet(); $snippet->settitle("test title2"); $snippet->setdescription("test descrition"); $snippet->settags(array("tag1", "tag2")); $snippet->setcategoryid("22"); $status = new google_videostatus(); $status->privacystatus = "private"; $video = new google_video(); $video->setsnippet($snippet); $video->setstatus($status);  $videodata = file_get_contents(root_dir.'/video-2012-11-23-23-24-45.mp4'); $r = $youtube->videos->insert("status,snippet", $video, array("data" => $videodata, "mimetype" => "video/mp4")); 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -