Sudden website error: SSL: Crypto Enabling Timeout


Hi Guys,

I’ve been using the same API code on my website for a long time to show my stream’s live status, channel title and game title but in the last few days it’s stopped working and when people access the website it’s coming up with this error:

** Warning : file_get_contents() [function.file-get-contents]: SSL: crypto enabling timeout**

This is the code I’m using:

$clientId = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
$json_array = json_decode(file_get_contents(''.strtolower($channelName).'?client_id='.$clientId), true);
if ($json_array['stream'] != NULL) {
    $channelTitle = $json_array['stream']['channel']['display_name'];
    $streamTitle = $json_array['stream']['channel']['status'];
    $currentGame = $json_array['stream']['channel']['game'];

Here is the URL:

Is there something I need to update?

Many thanks! <3


I’ve upgraded our version of PHP on the server and the Error we’re now getting is ‘SSL: Handshake timed out’. Has anyone seen this before/know how to fix it?


I’ve also discovered that Twitch partner Lethal Frag started having the exact same issue on his website that I’m having, so this isn’t an isolated issue.


Well you loaded http:// there…

Usually this is either a problem your side (most commonly your computer time is wrong)

Or less likely some royally f’ed up somewhere in the certficate chain ABOVE the site, which then isn’t a Twitch problem or you problem anyway.

Edit 1: ALSO, might also be the fact you are using file_get_contents which is horribly insecure for performing HTTP requests, use cURL instead. On most hosting providers fgc is blocked from performing these requests at the php.ini level for security reasons

Edit 2: Also your cert bundle could be totally out of date on your server, so check for an update that, which is never fun, some distros borked it up a while back and server admins had to faff about manually with bundles from cURL itself

How can I convert my API code from JSON to cURL