'Cannot connect to the api when the site uses cloudflare

I have a service site that also offers an api.

But my site users can not use the api, because the site is connected to cloudflare!

I connected to my site via file_get_contents, but got an error

That means I connected mywebsite.com/test.php to mywebsite.com/api/v2 ...

I got this error:

Warning: file_get_contents(): Peer certificate CN=`amazeservice.net' did not match expected CN=`mywebsite.com' in /home/mywebsite/public_html/test.php on line 3

Warning: file_get_contents(): Failed to enable crypto in /home/mywebsite/public_html/test.php on line 3

Warning: file_get_contents(https://mywebsite.com/api/v2): failed to open stream: operation failed in /home/mywebsite/public_html/test.php on line 3

I tried to ask this question in my cloudflare forum, but I do not know why it is not possible to post a question.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source