1

I am trying to use the YouTube Data API for PHP.

Locally, I am running Mac 10.6.7, MAMP 1.9.6 (PHP 5.3.5), Zend Gdata 1.11.11

I am attempting to run this simple script:

<?php

set_include_path('Zend/library');
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');

$yt = new Zend_Gdata_YouTube();
$videoEntry = $yt->getVideoEntry('the0KZLEacs');
print_r($videoEntry);

In this environment, this script causes the browser to hang until I restart MAMP. PHP and Apache logs report nothing.

The script works fine on my server.

This could either result from complications running Zend Gdata with MAMP (most likely) or complications in running Zend Gdata locally (less likely).

Because of the lack of data in the logs, this is hard to debug. Does anyone have an idea about how to go about debugging this, or a potential cause of the problem?

Note & Update: This is the route I would like to take, as I hope to perform more complicated actions (authentication and uploading). I know that I could go without the Zend Library, but that seems like a waste of time if the library already exists.

SomewhereThere
  • 374
  • 2
  • 7
  • It doesn't directly answer your question, but I [answered a question about the Youtube API](http://stackoverflow.com/questions/8509332/how-to-get-id-of-lastest-uploaded-video-on-youtube-channel/8509964#8509964) in which directly parsing the JSON response was easier than using a library. PHP has built-in functions for JSON which you could use for this. It's more portable than external dependencies. – Brigand Dec 16 '11 at 20:04

1 Answers1

2

If it's any help, using the you tube API is not that difficult.

I've previously written a blog post on how to access it using .NET, and since it's all XML then it shouldn't be too hard to translate it to PHP.

You can find my post here:

https://shawtyds.wordpress.com/2009/12/31/accessing-the-you-tube-api-from-c/

shawty
  • 5,729
  • 2
  • 37
  • 71