Reputation: 987
I'm a PHP newb trying out the YouTube API demo at http://www.youtube.com/watch?v=LMhN6pCAZWo.
I have the google-api-php-client and yt-samples-php-master directories that he says to download at
www.mysite.com/video/google-api-php-client and www.mysite.com/video/yt-samples-php-master
the search.php file is in yt-samples-php-master and I have replicated the video and set:
if ($_GET['q'] && $_GET['maxResults']) {
set_include_path("./google-api-php-client/src");
// Call set_include_path() as needed to point to your client library.
require_once 'Google_Client.php';
require_once 'contrib/Google_YouTubeService.php';
I can get to www.mysite.com/videos/yt-samples-php-master/search.php fine but when I search I get message:
Warning: require_once(Google_Client.php) [function.require-once]: failed to open stream: No such file or directory in /home/myusername/mysite.com/videos/yt-samples-php-master/search.php on line 17
Fatal error: require_once() [function.require]: Failed opening required 'Google_Client.php' (include_path='./google-api-php-client/src/') in /home/myusername/mysite.com/videos/yt-samples-php-master/search.php on line 17.
I noticed that the files Google make available have a typo require_once 'contrib/Google_YoutubeService.php';
should be require_once 'contrib/Google_YouTubeService.php';
but that doesn't seem to help. Any clues would be very gratefully received!
EDIT: I've also set 755 recursively through videos directory to sub-directories and files
Upvotes: 1
Views: 4834
Reputation: 3694
It's late. but someone may be looking for this in future.
Solution:
Upvotes: 3
Reputation: 987
OK I've come back to this after a little while. I've managed to get the search.php example to work by:
This lead to a fatal error saying that class Google_Service_YouTube could not be found in Google_YouTubeService.php. In that file there was however a class called Google_YouTube_Service which I renamed and then it worked!
Upvotes: 0
Reputation: 12877
Is google-api-php-client in the same folder as your project. Make sure you are setting the include to point to that directory. And that directory is 755'ed.
Also in latest (v1.0) php library they changed placing of sources to
require_once 'Google/Client.php';
require_once 'Google/Service/Youtube.php';
Upvotes: 0
Reputation: 4620
Just replace this ./
and try this following format
set_include_path("google-api-php-client/src");
Upvotes: 0