Uploading videos on YouTube using api without zend framework No client library (Elaboration of AuthSub for uploading videos on YouTube using core php php4 Browser based direct upload in corephp php4).
This post has been moved to http://www.codershelpingcoders.com/
please send me the working code…
Hello Asif,
We have mailed you the code for you tube upload.There are few directions in there to use that code.Please install it and use it and let us know in case there is any problem installing it.Do provide your valuable comments.
Cheers 🙂
Hello Asif,
We have mailed you the code for you tube upload.There are few directions in there to use that code.Please install it and use it and let us know in case there is any problem installing it.Do provide your valuable comments.
Cheers 🙂
thanks i have received that i will check it thnks for your quick response…
I have tried this code, and its working fine with curl and with file control to select the file.
But I want code for the uploading video without selecting file from the file control, and my dynamically generated file should go to youtube. Still i have not found any code for this direct uploading in core php, without using file control to select file.
It would be great, if you can provide code to upload dynamic video on my youtube channel.
Thanks in advance
Hello Dipak,
What do you mean by DYNAMICALLY GENERATED file here?
If you want to upload a video which is hosted to your site Then you will have to use VideoEntry object.You will have to use Zend Frame work
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource(‘file.mov’);
$filesource->setContentType(‘video/quicktime’);
// set slug header
$filesource->setSlug(‘file.mov’);
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
$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’);
// set some developer tags — this is optional
// (see Searching by Developer Tags for more details)
$myVideoEntry->setVideoDeveloperTags(array(‘mydevtag’, ‘anotherdevtag’));
// set the video’s location — this is also optional
$yt->registerPackage(‘Zend_Gdata_Geo’);
$yt->registerPackage(‘Zend_Gdata_Geo_Extension’);
$where = $yt->newGeoRssWhere();
$position = $yt->newGmlPos(‘37.0 -122.0’);
$where->point = $yt->newGmlPoint($position);
$myVideoEntry->setWhere($where);
// upload URI for the currently authenticated user
$uploadUrl = ‘http://uploads.gdata.youtube.com/feeds/api/users/default/uploads’;
// try to upload the video, catching a Zend_Gdata_App_HttpException,
// if available, or just a regular Zend_Gdata_App_Exception otherwise
try {
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, ‘Zend_Gdata_YouTube_VideoEntry’);
} catch (Zend_Gdata_App_HttpException $httpException) {
echo $httpException->getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
}
If you still want to do it without the Zend Framework there is still a way to do it.
hi,
may i know the codes for without using any framework to upload videos in youtube from an own site..please reply me soon…..my email id is
jagan.pand@gmail.com
hi
i want the core php codes in below things……
Hello Pandian.
we have mailed you the script.If you need help in deploying please let us know.
Hi,
I’ve got a script at the moment without the Zend but I want to have an entry form with the upload that allows me to put in the title and description.
Will I be able to do that with this script?
Thanks!
Yes Reece..I think you need a form where you can fill out description,tags and other metadata of the video and user using that form would be able to select the file to upload to YouTube.Yes that is possible and this script is the one to do so.
Let us know if you need any help in implementing it.
Thanx for commenting.
Cheers..
Hi,
Yes this sounds great, I’ve been looking for something like this for months now! 😀
Would you be able to email the script so I can give it a try?
Thanks
Reece
Your email address please?..
reece [at] ve3tro.com
Thanks
Hello Reece,
We have mailed you the script.
Have a look and comment if you need help deploying it.
Best Of Luck.
Thank you for the script.
Every time I choose to upload I get the Allow Access page from YouTube. Is there a way I can put in my login details on the script so then it bypasses the Allow Access page?
What I want this for is to allow many people to use the script to upload videos to my channel without the need to login.
Yes Reece,If you have studied the script.Look for AuthSubSessToken.Obtain it once and hardcode the same permanently in $_SESSION[‘AuthSubSessToken’] it will never take you to the Access page again.Only Once it will unless the token is revoked.
Try it.
Please Send me the full code for uploading videos to youtube.Iam not an expert in coding..So please send me the full code for that..Also i need the videos directly upload to my account only..because i want to organize all my site videos under a single channel or user account.Please help me..
Thanks in Anvance
Happy NewYear 2012
My Email ID is friend007u@gmail.com
Alex Lalu
Hello Alex,
We have mailed you the code.Kindly find the attachment and let us know if you need help in deployment.
Hello Reece,
Hope that helped you.I will not be available for sometime due to some health problems but in case there is something more i can do just leave a comment.But i am sure the last trick had already helped you.
Enjoy.
im interested..please can u email me the script mizzsuzy@gmail.com
Hello Suzy,
We have mailed you the script.Please check.
Cheers.
hi, can u give me the instruction to guide for develop the script?
What you found Difficult Suzilala?Its very easy to deploy that.Tell us where you need help?All you have to do is make a form as in the script and it will work for you…where do you find it difficult?
Hello Suziala,
All you have to do is to make a form which will collect the data about the video such as title tags etc and upload it using cURL and then obtaining a form upload token and posting the video to YouTube.Thats It.
Do it like that.And let us know where is the problem.
Hello Suzi,
After clicking ACCEPT and when it comes back to you site.You just have to select the video and upload it.
Thats all.
Ok. after i click the ACCEPT, it will back to my site then i upload the video.where BUTTON UPLOAD should go?
Yes Suzi.It should upload your video to YouTube.
People if this has helped you.Please care to give it a like.Will take a minute of yours only..
Thanx :-)..will keep you posted on new techniques or things that i discover.Or you can suggest me too.
Thank you for the tutorial, sorry I didn’t get back quicker just been a little busy. I’ve had a look over the script but not completly filled out the details yet.
I shall have a go tonight to see how it goes. 😀
Thanks again!
Hello,
First, thank you so much for this tutorial, it’s the only place on internet where someone try to do that without Zend Framework.
I pass the 1st step but I have some troubles on the other steps, i’m really interested in this working script if you can.
Thank you
(My email is fastcreasite [at] gmail [dot] com )
Hello,
We have mailed you the script.Have a look.
Cheers.
Please, can you send me the working code?
Hello Paolo,
Your email Id please?
See my profile. I have send to you an e-mail too. Thank you.
Hello Paolo,
Please check your account for the script.
Thanks.
Thank you. It’s working fine. Here a reference that help me too:
http://code.google.com/intl/it-IT/apis/youtube/2.0/developers_guide_protocol_browser_based_uploading.html
Glad it helped you Paolo,You must spare a minute to like the post.
I want to send to my youtube acount (with user and pass) a video record and hosted in my website. each one of my users will can upload his videos to my youtube acount.
and i dont want to use Zend Library. Its posible??
thanks
Hello Karaka,
Do you want a user to able to select the video from his/her system and then upload it to you tube account then yes this tutorial is all about that.If you want to upload a video that is already stored on your server than we will have to see.I think direct upload will work in that case.So what is your case here?.
i dont understand very well. i dont want the users to able to select the video from his/her system and upload. no is this
my aplication record videos by webcam and i stored in my server (flv file, i think). I give them the option to upload the video from my server to my youtube account when they press a button
i dont want use zend library, i want AuthSub with my youtube user and upload video from url (my server).
sorry, my english is underground. thanks
Then you will need DIRECT UPLOAD karaka and this tutorial is about browser based uploading.
i cant find code about direct upload. can you help me?
Here it is http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html
Thanks. i continue to find
Please, send me the working code.
Thank you!
Hello Dmitry,
Whats your email address?
Hello,
d-man AT mail.ru
we have mailed you the code Dmitry please check.
Yep, I got it. Thank you! but there is something wrong with curl_.
Fatal error: Call to undefined function curl_init()
I don’t have an ability to change server’s configuration. So are there any other functions that can be used instead of curl funcs?
You can contact your server tech support and ask them to install it..That is all you need.
Dmitry you should have libcurl installed else the code wont work.
51 comments and 0 likes 😦
Hello,
Nice tutorial. I need working code for direct browser based uploading to youtube from my website in core php using curl.
my id is : tejaspmehta@gmail.com
Thank you
Tejas Mehta
Hello Tejas,
We have mailed you the script.Please have a look and let us know if you need help deploying that.
Also please spare a moment to like this post if this was helpful to you.
Cheers.
Hello,
I have received script but i am bit confused how to use it. What my requirement is that if any user come to site and upload video (10 MB) then it should be uploaded to youtube in my predefined account and in return i should get URL of that video (to store in my db)
Now when i run this script by changing xxx.com to my-site.com it takes me to youtube page and then ask me for access. I clicked on allow access and it took me to my-site.com. I did not get form which you have placed at end of page for uploading video.
Also you have not mentioned that where to get keys which is in variable $key.
Thank you
Tejas Mehta
Hello Tejas,
The key is the developer key you generate from your google dashboard you can find it here.http://code.google.com/apis/base/signup.html and this is elaboration tutorial of the Browser based upload.Means a user does not have to upload the video on your server first.He can directly upload the video to YouTube into your account.You dont really need to host the videos on your site.Which means half of your work is saved.Also you have to give the path of this script in your next url like http://www.xxx.com/script.php.But one thing i am not sure you can achieve with this is the storing of URL of video in database this technique doesnt really gives back the URL of the video but gives you a response code of 400 or 200 on successful and failed uploads.This you will have to confirm.
If i can help in any way please let me know.
Signing Off
Cheers.
🙂
Can u plz send me the code
Your email address?
Could you please send me the workable code?
Thanks in advance.
Could you please send me the workable code?
aantu69@yahoo.com
Thanks in advance.
Hello Sohrab,
We have mailed you the code.Please check.
Thanks for liking.
Thanks for your quick response. Its unbelievable.
But one thing, while the page is loading , its redirect to http://support.google.com/accounts/bin/answer.py?hl=en&p=youtube&answer=40039
and here saying that
“Unable to access a Google product
If you’ve been redirected to this page from a particular product, it means that your access to this product has been suspended. Read on for more information……….bla bla bla”
I am unable to solve this problem.
If you can help me, I’ll be grateful to you.
Thanks
Sohrab
aantu69@yahoo.com
Hello,
Can you give us the link where you are experiencing this problem?It should not take you to this page instead it should allow you to take to the access page where you need to verify the access for the app which will give you the access token and you are ready to upload videos on YouTube.
Cheers…
my video doesnt upload. Please help me.
http://www.yourekas.com/video
Thanks.
Please leave your email address again
when i click on video upload it doesn’t go anywhere and doesn’t start uploading and also it doesn’t return us the uploaded video id.
my email is
aantu69@yahoo.com
Thanks.
Please place the updated script and let us know
Thanks. many many thanks.
Its working now.
I am really happy for your unbelievable response.
Thanks again.
You are welcome.
Hello Zend Tutorial,
I have downloaded the latest zend-library and have installed it on a RHEL6 (and its latest PHP). Kindly send the codes my way as well at the following email address, please:
g o r a b i [doNotSpamPlease-AT] g m a i l [doNotSpamPlease-DOT] .com
Hello Ahmad,
This is the code to work without Zend Framework..Not with Zend framework.
That would still be cool by me! Kindly send it my way.
Also, are you able to place a full-text-caption (not timed caption) onto the youtube video that you upload, thru this code as well? That would be a PERFECT combo.
We have mailed you the code Ahmad.Please have a look.
I’ve saved your script to localhost, generated the developer key at: http://code.google.com/apis/youtube/dashboard
…and I do get the ‘token’ fine, http://localhost/yt/script.php?token=
But upload Youtube Metadata (title, category, description, keyword—filled out in the form), goes NO-PLACE. Not sure what I’m missing. Printed your 4-step doc’n as well, I guess the script is stuck at 2 (part a)— use token to get AuthSubSessionToken
Uploading the metadata will issue you a GetUploadToken which the mechanism will set in the form for your video upload.If upload meta data is successful you can upload the videos there and you can see your metadata on the video you have uploaded.
Hello, could you please send me the code?
qazzz789@aim.com
thanks in advance
We have mailed you the code Qazzz Please check.
i haven’t received it 😦
can you try sending it again
thank you
lol i wasnt sure how much time had passed since your post, ill check later today
thanks you for the code
I got it. Thank you! Trying to decipher and understand it. I like it off the bat, as it is using sessionIDs. My first go at the script did not work. Note: meta-data & its upload, together with video-choice & upload are all appearing on the same page-view (it is a bit confusing). If it was hiding the video-upload, until it had the meta-data values, would have been more of an eye candy (he He).
Thanks again.
Glad it helped you.
People please be generous in liking the post if it had helped you in any way.
Hi!
I would very much like to have a look at the code, could you please mail it to nospamkthxlulz@gmail.com?
Thanks!
Hello.
We have sent you the script.Please check.
hi can you please send me this code at my mail address naveed_uop (at the rate of) yahoo (dot) com. please i need this as soon as possible.
Hello.
We have sent you the script.Please check and see.
thanks.
But this code is not in working condition. can you please send me the working example.
Why do you say that doesnt works?Did you followed the steps?It is the working Code Naveed.
i have included jquery it uploads meta data but when i click on video upload it doesn’t go anywhere and deosn’t start uploading and also it doesn’t return us the uploaded vdeo id.
We have mailed you the new script.Please have a look.
thanks it is ok now
But this code is not in working condition. can you please send me the working example.
I can’t it to work either.
I’ve set $key to my Google Developer Key and set the url to http://www.mydomain.com/script.php.
I authorize the “application” and then input the meta data and upload it (doesn’t seem like it gets uploaded) and then I choose which file to upload and press upload (doesn’t seem to upload either, since it takes a millisecond).
^ Should be and set the $nextUrl to http://www.mydomain.com/script.php
its 404
We mailed you new script.Try it.
Can you go down the code and change the ajax call from index.php to script.php
Ah, now it seems to send the meta data atleast, but when uploading the video file it just redirects immediately, no upload.
Just want to thank you for your persistance with my problems, but I would be very happy if you could help me out to get this script working, as I mention in the last reply, it seems like the meta data is now being sent to YouTube, but the file does not get uploaded with you press upload, it just reloads the page, what causes this? Thank you in advance.
Please send the link again.
http://persturesson.com/script.php
Can you give me access to the server i have to check it.
Seems like your ajax call is not perfect here.
On Uploading metadata there we get an Upload url and a token there is a mechanism to set it in the form action and token hidden field and i can see you are not getting back the url or token that is why you dont get to upload the videos.
What do you suppose I’ll change?
I have to see it in running condition on the server.
Where should I mail the login credencials?
same as where you got the script from.
I have corrected an error on the url you gave me.But there is some issue on the youtube side..I have escalated that will be back to you with a solution.Thanks for your trust and patience.
Hello,
Its working now you can check.
Can you give us a URL where we can see it?
Hi, can you please send me the code I would like to have a look at it..
Thanks
Hassi
Please provide Your email address?
wahabcool[at]gmail[do][com]
We have mailed you the script please let us know if you need help in deploying it.
Hi, can you send me the code please?
i really apreciate it, can i implement this code using adobe flash builder ?
metalor21@gmail.com
Hello Leo,
This is a php based code.I dont know what is adobe flash builder is about.
Could you please email the code? Thank you in advance!
Whats your email address?
The email address is: radu.maruntelu[at]becmedia.ro
Thank you!
Please leave your email address again for updated YouTube Script.
My email address is radu.maruntelu[at]becmedia.ro
Please send me the updated script.
Thanks again!
Hi Can i i received code too: arbacom[at]interia.pl ?
I have sent you the code please check
Please check now.
hi please send the code at my id.
my id : engitj [at] gmail [dot] com
Thanx admin, awesome work with the script ,though 1 ques can the auth session token be used for future upload ,without having the user to log in youtube ?
Sorry For the delayed reply John.If You store the AuthSubSession permanently in your session variable then it wont go to the YouTube Authorization page again.
Hi
Please email me the code
Your Email address Please?
Hi,
My email address is amolbhosale123@gmail.com
Please send me the updated script.
Thanks,
Amol
Hello Amol,
Please check your email for the code.
Regards
CodersHelpingCoders