Witam.
Poniższy skrypt uploaduje filmy na Youtube'a.
W formularzu chciałbym dodać inputy:text z tytulem i opisem filmu,
lecz aby wygenerować url akcji w formularzu muszę wczesniej ustawić parametry title , desc oraz kategoria.
  1. $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
  2. $myVideoEntry->setVideoTitle('Tytul filmu');
  3. $myVideoEntry->setVideoDescription('Opis filmu');
  4. $myVideoEntry->setVideoCategory('Kategoria');


Jak zrobić by to użytkownik mógł wprowadzać tytul i opis, a nie ja w tym momencie te parametry są sztywno podane.
Czy ew. można jakoś po id filmu aktualizować wstawiony opis na własny...

  1. if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
  2.  
  3. $authUrl = Helper_Youtube::getAuthSubRequestUrl();
  4.  
  5. $youtubeForm =
  6. <<<END
  7.   <h3>Wymagana autoryzacja!</h3>
  8.   <p><a href="$authUrl">Musisz uzyskać dostęp do alikacji zanim rozpoczniesz</a> .<p>
  9. END;
  10. //if token has been requested but not saved to a session then save the new token to a session
  11. } else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
  12.  
  13. $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
  14.  
  15. }
  16.  
  17. if(isset($_SESSION['sessionToken'])) {
  18.  
  19. //authenticat with youtube
  20.  
  21. $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
  22. $developerKey = 'AI39si7DzQqPEc7tlcmJR8Ohils_6DsJ_3*****A_lVnfpueja-MpKBuPsJpghqezJFmoV-n1aYRR-wrKy2IA';
  23. $applicationId = '14456169*******sercontent.com';
  24.  
  25. $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, NULL, $developerKey);
  26.  
  27. // create a new VideoEntry object
  28. $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
  29. $myVideoEntry->setVideoTitle('asdasdsadsadsad');
  30. $myVideoEntry->setVideoDescription('jsadsadsadasdsadssadlm');
  31. $myVideoEntry->setVideoCategory('Autos'); // The category must be a valid YouTube category!
  32.  
  33.  
  34.  
  35. $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
  36. $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
  37. $tokenValue = $tokenArray['token'];
  38. $postUrl = $tokenArray['url'];
  39.  
  40. // place to redirect user after upload
  41. $nextUrl = 'http://localhost/fp/Wedding/Youtube/Add/';
  42.  
  43. // build the form
  44. $youtubeForm =
  45. <<<END
  46.   <form action="$postUrl?nexturl=$nextUrl" method="post" enctype="multipart/form-data">
  47.   <input name="file" type="file"/>
  48.   <input name="token" type="hidden" value="$tokenValue"/>
  49.   <div class="form-actions">
  50.   <button type="submit" name='videoupload' class="btn btn-blue">Zapisz plik!</button>
  51.   </div>
  52.   </form>
  53. END;
  54.  
  55. if(isset($_GET['status']) && $_GET['status'] == '200'){
  56. echo '<h1>Video Upload</h1>';
  57. }