CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: https - using file_get_contents - Windows 11  (Read 239 times)

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 787
  • Karma: +8/-0
    • Grumpy Young Man
https - using file_get_contents - Windows 11
« on: 3 Jan 2023, 03:21:17 am »
Despite being enabled in the loaded PHP.ini, file_get_contents wil not load HTTPS using PHP 8.2.0

phpinfo
Code: [Select]
OpenSSL support disabled (install ext/openssl)


Quote
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

Code: [Select]
     // Syntax: sprintf($url, "PackageName", "VRM", ApiKey);
    $url = sprintf($url, "VehicleAndMotHistory", $vrm, $ApiKey);
    // Note your package name here. There are 5 standard packagenames. Please see your control panel > weblookup or
    // contact your account manager

    // Create a stream
    $opts = [
        'https' => [
            'method' => "GET",
            'header' => "Accept-language: en\r\n"//.
            //"Cookie: foo=bar\r\n"
        ]
    ];

    $context = stream_context_create($opts);

   // Open the file using the HTTP headers set above
    $vehicleData = file_get_contents(
        $url,
        false,
        $context
    );

    // Make the returned JSON into an usable array:
    return json_decode($vehicleData, true);
Any idea onhow to get this working on Windows...

Thanks in advance.
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1049
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: https - using file_get_contents - Windows 11
« Reply #1 on: 9 Jan 2023, 07:06:45 am »
phpinfo
Code: [Select]
OpenSSL support disabled (install ext/openssl)
Do we see the problem here? One word. Pretty obvious word.
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 787
  • Karma: +8/-0
    • Grumpy Young Man
Re: https - using file_get_contents - Windows 11
« Reply #2 on: 9 Jan 2023, 08:55:19 am »
phpinfo
Code: [Select]
OpenSSL support disabled (install ext/openssl)
Do we see the problem here? One word. Pretty obvious word.

This:
Quote
(install ext/openssl)
OpenSSL is enabled in the php.ini and the extension exists in the ext directory? So... its not obvious to me?
« Last Edit: 9 Jan 2023, 08:56:50 am by GrumpyYoungMan »
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

 

SMF spam blocked by CleanTalk

Advertisement