# File\_get\_contents(): SSL error

**URL:** https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106
**Category:** Hosting Support
**Created:** [August 7, 2020, 9:42pm UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106 "2020-08-07T21:42:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anon46231007](https://forum.infinityfree.com/letter_avatar/anon46231007/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon46231007](https://forum.infinityfree.com/u/anon46231007)
#### Post date: [August 7, 2020, 9:42pm UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106/1 "2020-08-07T21:42:02Z")

</div>

Hello

There is new error I get each time I uses  
file\_get\_contents() for any SSL URL

My username  
epiz\_24927975

Website url  
[http://yanivhatulim.rf.gd/test.php](http://yanivhatulim.rf.gd/test.php)

### Error Message

**Warning** : file\_get\_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls\_process\_server\_certificate:certificate verify failed in **/home/vol8\_7/epizy.com/epiz\_24927975/htdocs/test.php** on line **3**

**Warning** : file\_get\_contents(): Failed to enable crypto in **/home/vol8\_7/epizy.com/epiz\_24927975/htdocs/test.php** on line **3**

**Warning** : file\_get\_contents([Bitcoin (BTC) Price | BTC to USD Price and Live Chart](https://www.coindesk.com/price/bitcoin?foo=btc)): failed to open stream: operation failed in **/home/vol8\_7/epizy.com/epiz\_24927975/htdocs/test.php** on line **3**

### test.php Code:
\<?php $res=file\_get\_contents("https://www.coindesk.com/price/bitcoin?foo=btc"); echo $res; ?\>

---

<div class="post-metadata">

### Author: ![anon99413185](https://forum.infinityfree.com/letter_avatar/anon99413185/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon99413185](https://forum.infinityfree.com/u/anon99413185)
#### Post date: [August 8, 2020, 2:53am UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106/2 "2020-08-08T02:53:43Z")

</div>

Maybe related to this problem:

> [@PHPMailer Suddenly Stopped working](https://forum.infinityfree.com/t/phpmailer-suddenly-stopped-working/33986/4):
>
> We upgraded OpenSSL on our servers a few days ago. This may have resulted in SSL for SMTP breaking. I’m going to do some investigation into this. The provided SMTPOptions are a good workaround until then. Please note that you should AVOID such SMTPOptions as much as possible, because fixing SSL issues by disabling most SSL security features is NOT a good solution.

This is the temporary/permanent solution:

> [@Cannot Alter PHP Config](https://forum.infinityfree.com/t/cannot-alter-php-config/33971/8):
>
> You try to get external contents with HTTPS URL via that function. Maybe [CA bundle](https://www.php.net/manual/en/migration56.openssl.php) in the hosting wasn’t setup correctly. You can get around this problem by writing a custom function that uses curl, as in: function file\_get\_contents\_curl( $url ) { $ch = curl\_init(); curl\_setopt( $ch, CURLOPT\_AUTOREFERER, TRUE ); curl\_setopt( $ch, CURLOPT\_HEADER, 0 ); curl\_setopt( $ch, CURLOPT\_RETURNTRANSFER, 1 ); curl\_setopt( $ch, CURLOPT\_URL, $url ); curl\_setopt( $ch, CURLOPT\_FOLLOWLOCATION, TR…

---

<div class="post-metadata">

### Author: ![TigerMANEK426](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/tigermanek426/32/12600_2.png) [@TigerMANEK426](https://forum.infinityfree.com/u/TigerMANEK426)
#### Post date: [August 8, 2020, 6:30pm UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106/3 "2020-08-08T18:30:57Z")

</div>

Welcome!  
There is a solution on here on how to prevent this problem:

> [@SSL operation failed with code 1 (ReCaptcha)](https://forum.infinityfree.com/t/ssl-operation-failed-with-code-1-recaptcha/34068/3):
>
> I use a library to perform this. Thanks for your response, I will try your fix +1

---

<div class="post-metadata">

### Author: ![anon46231007](https://forum.infinityfree.com/letter_avatar/anon46231007/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon46231007](https://forum.infinityfree.com/u/anon46231007)
#### Post date: [August 11, 2020, 4:45pm UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106/4 "2020-08-11T16:45:42Z")

</div>

got it thank you

---

<div class="post-metadata">

### Author: ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)
#### Post date: [August 26, 2020, 4:45pm UTC](https://forum.infinityfree.com/t/file-get-contents-ssl-error/34106/5 "2020-08-26T16:45:50Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
