Asked  7 Months ago    Answers:  5   Viewed   43 times

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 'GuzzleHttpExceptionRequestException' 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.

 Answers

46

If you are on Windows using Xampp, I am stealing a better answer from here, would be helpful if Google shows you this question first.

  1. Download and extract for cacert.pem here (a clean file format/data)

    https://curl.haxx.se/docs/caextract.html

  2. Put it in :

    C:xamppphpextrassslcacert.pem

  3. Add this line to your php.ini

    curl.cainfo = "C:xamppphpextrassslcacert.pem"

  4. restart your webserver/Apache

Wednesday, March 31, 2021
 
Litty
answered 7 Months ago
23

I finally got this working and got the insight zip file download in the feed when calling "getVideoFeed" with the URL: "http://gdata.youtube.com/feeds/api/users/default/uploads" make sure though you setMajorVersion(2) on the Youtube connection object.

Please note: After speaking to YouTube directly the Insight ZIP returns 7 days by default, although changing the user_starttime you can get a MAXIMUM of 28 days.

Hope this helps someone in the future!

James

Wednesday, March 31, 2021
 
fret
answered 7 Months ago
19

Follow the below steps to work curl on wamp

Note: wamp server having multiple version of php so changes need to made in all php.in files

Step 1: Download the certificate bundle. Copy to C:/wamp64/

Step 2: Open php.ini by clicking wamp icon in notification bar also open version specific php.ini file through directory ie "E:wampbinphpphp7.1.22".

Step 3: Remove ; before ;extension=php_openssl.dll (ignore if already removed)

Step 4: Find [curl] in php.ini then add below curl.cainfo="C:/wamp64/cacert.pem"

Step 5: Find [openssl] in php.ini then add below openssl.cafile="E:wampcacert.pem"

step 6: Reastart wamp

Saturday, May 29, 2021
 
msg
answered 5 Months ago
msg
47

Finally got this to work!

  1. Download the certificate bundle.

  2. Put it somewhere. In my case, that was c:wamp directory (if you are using Wamp 64 bit then it's c:wamp64).

  3. Enable mod_ssl in Apache and php_openssl.dll in php.ini (uncomment them by removing ; at the beginning). But be careful, my problem was that I had two php.ini files and I need to do this in both of them. One is the one you get from your WAMP taskbar icon, and another one is, in my case, in C:wampbinphpphp5.5.12

  4. Add these lines to your cert in both php.ini files:

    curl.cainfo="C:/wamp/cacert.pem"
    openssl.cafile="C:/wamp/cacert.pem"
    
  5. Restart Wamp services.

Tuesday, June 1, 2021
 
BrunoRamalho
answered 5 Months ago
65

Streaming from an iOS device is no different than streaming from any other device. You would have to write an h264 encoder and RTMP packetizer, and send the video to your YouTube stream object's ingestionAddress. Outlining the details of the encoder beyond the above is too broad for Stack Overflow, but I highly recommend looking at the VideoCore iOS project.

As far as branding goes, the only way to play back YouTube content in an iOS app without breaking YouTube's terms of service is to play the video in a UIWebView or YouTube's iOS player helper library (which is just a web view with some playback interfaces).

There is no way to completely remove YouTube branding from the IFrame player. However, there are branding options you can toggle using the modestBranding flag on the player. See the IFrame docs here.

Saturday, September 4, 2021
 
d8aninja
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :