I want to collect a list of videos uploaded on a specific channel using the YouTube data API. However, before implementing online I am trying to get my code running on an offline environment (WAMPserver, PHP 5.5.12, Apache 2.4.9). I am using the following code:
require_once 'google-api-php-client-2.0.0-RC5/vendor/autoload.php';
$client = new Google_Client();
$client->setApplicationName("SRC_Thor");
$client->setDeveloperKey("xxxxxxxxxxx");
$youtube = new Google_Service_YouTube($client);
$channelResponse = $youtube->channels->listChannels('contentDetails', []);
var_dump($channelResponse);
However it gives the following error:
Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see
http://curl.haxx.se/libcurl/c/libcurl-errors.html
)'
I have tried adding the latest version of cacert.pem
as most topics on SO offer as a solution, however to no avail.
$client->setDefaultOption('verify', false);
so that it doesn't attempt to perform the verification? Obviously on the live server it won't be an issue given that the live server will have a correct certificate (assumedly) – Ohgodwhy Feb 25 '16 at 21:28Call to undefined method Google_Client::setDefaultOption()
any idea why? – Sjors Hijgenaar Feb 25 '16 at 21:39setDefaultOption
method has been removed fromGoogle_Client
. Use @Phung answer it worked for me! – Elharony Jul 25 at 6:26