$httpClient =
Zend_Gdata_ClientLogin::getHttpClient(
$username = '****#gmail.com',
$password = '*****',
$service = 'youtube',
$client = null,
$source = 'testphp',
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
I have got the above code from code.google.com. I want to know what authenticationURL should be. I new to this help me out
If you copied your code from here, then you missed this line:
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
That's what it is.
Related
I have not much idea about PHPCR.I am doing a sample prototype to store the files into a WebDav server.The code snippet is given below.It's only creating the node.But I want the file to be stored in the server.
$jackrabbit_url = 'http://xxxxxxxxxx:8900/jackrabbit/server';
$user = 'xxxxxx';
$pass = 'xxxxxx';
$workspace = 'default';
$factory = new \Jackalope\RepositoryFactoryJackrabbit();
$repository = $factory->getRepository(
array("jackalope.jackrabbit_uri" => $jackrabbit_url)
);
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
$session = $repository->login($credentials, $workspace);
$node = $session->getNode('/test');
$imageURL ='/var/www/sxnew/phpcr/web/uploads/FolderE/test.png';
$contents = base64_encode(file_get_contents($imageURL));
$image = $node->addNode("test.png");
$image->setProperty("jcr:content", "nt:resource");
$image->setProperty("jcr:data", $contents);
$image->setProperty("jcr:mimeType", "image/png");
$session->save();
Please help anybody
I am using the library googleads/googleads-php-lib from github.
I am trying to create a text ad, but I am getting an error that I cannot set the URL field. The code has been working for quite some time but has suddenly stopped due to this error.
The SoapFault exception that is thrown is:
[AdError.CANNOT_SET_FIELD # operations[0].operand.ad.url]
My code is as follows:
require_once('Google/Api/Ads/AdWords/Lib/AdWordsUser.php');
$developerToken = '*removed*';
$clientCustomerId = '*removed*';
$userAgent = 'test';
$settingsIniPath = './vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/settings.ini';
$oAuth = array(
'client_id' => '*removed*',
'client_secret' => '*removed*',
'refresh_token' => '*removed*',
);
$adWordsUser = new AdWordsUser(null, $developerToken, $userAgent, $clientCustomerId, $settingsIniPath, $oAuth);
$adWordsUser->SetDefaultVersion('v201409');
$adGroupId = *removed*;
$textAd = new TextAd();
$textAd->headline = 'headline text';
$textAd->description1 = 'description1 text';
$textAd->description2 = 'description2 text';
$textAd->displayUrl = 'www.example.com';
$textAd->url = 'http://www.example.com/';
$adGroupAd = new AdGroupAd($adGroupId, $textAd);
$operations = array(new AdGroupAdOperation($adGroupAd, null, 'ADD'));
$adGroupAdService = $adWordsUser->GetService('AdGroupAdService');
$result = $adGroupAdService->mutate($operations);
I am not sure what could be causing this error. Any help would be greatly appreciated.
got caught with that too. The problem seems to be that "url" is no longer supported, you have to use "targetUrls" of upgraded URLs API instead:
http://googleadsdeveloper.blogspot.cz/2015/05/reminder-adwords-destination-urls-will.html
I'm trying to get a youtube video from the $username with $tags:
$tags='detskij-sad-198';
require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = 'Schoolkharkovua',
$password = '*****',
$service = 'youtube',
$client = null,
$source = '*****',
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$devkey = '*****';
$yt = new Zend_Gdata_YouTube($httpClient, '', '', $devkey);
$yt->setMajorProtocolVersion(2);
$query = $yt->newVideoQuery();
$query->setMaxResults(4);
$query->setVideoQuery($tags); // also i tried $query->category = $tags;
$query->setAuthor($username);
$videoFeed = $yt->getVideoFeed($query->getQueryUrl(2));
$videoFeed returns no entry, although I know that the $username has a video with $tags and this code to work until mid-March
If I do query only by the $username or by $tags - I get the result.
What am I doing wrong?
PS. http://gdata.youtube.com/demo/index.html return empty video feed too if I trying query by "Keywords" and "Author name" simultaneously
Hhhhhmmmmm.... It seems that "google" no longer get the symbols "-" in tags
But
echo 'Tags: ' . implode(", ", $videoEntry->getVideoTags());
still emty, youtube api don't return video tags!
Guys help me get video tags from my video channel, please!
You need to authenticate your connection, YT returns an empty media$keywords object now (as of last Aug).
https://developers.google.com/youtube/2.0/developers_guide_php#Authentication
and here's their blog post about it...
http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html
I am using the "youtube api" for PHP library, ie zend.
My goal is to set the description, ie what you see when you open the channel of a user in the textbox at the right.
What I did.
function anmelden_yt($name,$passwort)
{
$yt_source = 'sou'; //name of application (can be anything)
$yt_api_key = 'ak';
$yt = null;
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = $name,
$password = $passwort,
$service = 'youtube',
$client = null,
$source = $yt_source, // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
return new Zend_Gdata_YouTube($httpClient, $yt_source, NULL, $yt_api_key);
}
$yt = anmelden_yt('name','pw');
$yt->setMajorProtocolVersion(2);
$userProfileEntry = $yt->getUserProfile('name');
$userProfileEntry->setAboutMe('test');
$userProfileEntry->setContent('test');
$userProfileEntry->setSummary('test');
Nothing changed.
Those fields are no longer exposed via the API. They also don't correspond to the channel description display that you're referring to. There currently isn't a way to set that channel description via the API.
I just can't seem to get this API working. My eyes are missing the mistakes I'm making. The problem I have is that the page still Shows BLANK.
I need the form to upload the data onto Youtube which will later be displayed on my website.
Here is my code:
<?php
require_once 'library/Zend/Loader/AutoloaderFactory.php'; // the Zend dir must be in your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
// start a new session
session_start();
function getAuthSubRequestUrl()
{
$next = 'http://www.example.com/welcome.php';
$scope = 'http://gdata.youtube.com';
$secure = false;
$session = true;
return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}
function getAuthSubHttpClient()
{
if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
echo 'Login!';
return;
} else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
$_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
}
$httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
return $httpClient;
}
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
$httpClient =
Zend_Gdata_ClientLogin::getHttpClient(
$username = 'myuser#gmail.com',
$password = 'mypassword',
$service = 'youtube',
$client = null,
$source = 'MySource', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$developerKey = 'ABC123 ... ';
$applicationId = 'Video uploader v1';
$clientId = 'My video upload client - v1';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
// Assuming that $yt is a valid Zend_Gdata_YouTube object
$yt->setMajorProtocolVersion(2);
function getAndPrintVideoFeed($location = Zend_Gdata_YouTube::VIDEO_URI)
{
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
function printVideoFeed($videoFeed)
{
$count = 1;
foreach ($videoFeed as $videoEntry) {
echo "Entry # " . $count . "\n";
printVideoEntry($videoEntry);
echo "\n";
$count++;
}
}
// Note that this example creates an unversioned service object.
// You do not need to specify a version number to upload content
// since the upload behavior is the same for all API versions.
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory('Autos');
// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry->SetVideoTags('cars, funny');
$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
$tokenValue = $tokenArray['token'];
$postUrl = $tokenArray['url'];
// place to redirect user after upload
$nextUrl = 'http://www.example.com/youtube_uploads';
// build the form
$form = '<form action="'. $postUrl .'?nexturl='. $nextUrl .
'" method="post" enctype="multipart/form-data">'.
'<input name="file" type="file"/>'.
'<input name="token" type="hidden" value="'. $tokenValue .'"/>'.
'<input value="Upload Video File" type="submit" />'.
'</form>';
echo "aaaa".$form;
?>
Here is my code with Zend
//include Zend Gdata Libs
require_once("Zend/Gdata/ClientLogin.php");
require_once("Zend/Gdata/HttpClient.php");
require_once("Zend/Gdata/YouTube.php");
require_once("Zend/Gdata/App/HttpException.php");
require_once('Zend/Uri/Http.php');
//yt account info
$yt_user = 'myuser#gmail.com'; //youtube username or gmail account
$yt_pw = 'mypassword'; //account password
$yt_source = 'title of my video'; //name of application (can be anything)
//yt dev key get here : https://code.google.com/apis/youtube/dashboard/
$yt_api_key = ''ABC123 ... ''; //your youtube developer key
//login in to YT
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = $yt_user,
$password = $yt_pw,
$service = 'youtube',
$client = null,
$source = $yt_source, // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
// Note that this example creates an unversioned service object.
// You do not need to specify a version number to upload content
// since the upload behavior is the same for all API versions.
//$yt = new Zend_Gdata_YouTube($httpClient);
$yt = new Zend_Gdata_YouTube($httpClient, $yt_source, NULL, $yt_api_key);
I can Upload my file and after a while I'm redirected to "$nextUrl".
My issue is that I get this page : http://www.example.com/youtube_uploads?statu=400&error=failed
And I don't no why.
Any Idea, please ?