1

I am trying to deal with the TMDb API (The Movies Database).

I am getting the following error displayed again and again:

file_get_contents: Unable to find the wrapper “https” (XAMPP / Windows)

For this code:

    $json = file_get_contents("https://api.themoviedb.org/3/movie/5?api_key=XXXYYYZZZ&language=de-DE");
    $result = json_decode($json, true);

I have uncommented:

extension=openssl

and

extension=php_openssl.dll

on my php.ini an restartet XAMPP, but the problem persists.

What else can I do to solve this problem? :(

hashyx
  • 87
  • 7
  • In which `php.ini` have you made the modifications? (You can run `php --ini` in the console to see the php.ini files on your machine and the one that is actually loaded. Make sure your modifications are done in the loaded one) – Prince Dorcis Aug 15 '20 at 12:13
  • 1
    The configurations you need are `extension=php_openssl.dll` and `allow_url_include = On`. But I will likely use `cURL` instead of `file_get_contents`. https://stackoverflow.com/q/127534/14066311 – Prince Dorcis Aug 15 '20 at 12:16
  • I have only one php.ini: x:\Program Files\xampp\php\php.ini I made the changes mentioned by you, but it doesn't work. I will try curl instead. – hashyx Aug 15 '20 at 16:45
  • 1
    I switched to MAMP. Everything is working now. – hashyx Aug 15 '20 at 19:10

1 Answers1

1

file_get_contents is not good for HTTPS

Try with curl or some other HTTP libs like here or here

Praveen
  • 294
  • 4
  • 9