On my Windows 10 machine, I run some PHP scripts that call API functions on a game, Torn. Torn allows and encourages the call of such API.
Since a few days, all my command line scripts stopped working from my machine.
I verified this both running them from the command line, and setting a quick web server with php -s
Both modalities were working earlier.
The scripts running on a separate websites still work.
I suspect the cause may be a recent Windows update.
What am I doing wrong, and how do I fix this?
I tried with PHP version 7.4.6 and 8.4.4, CLI, NTS, x64
Here is the code, and the result:
<?php
$jsonurl = "https://api.torn.com/faction/16335?selections=basic&key=aaa";
$json = file_get_contents( $jsonurl ) ; //gets output of API
$decodedString = json_decode( $json, true ) ; //parses API JSON output
print_r( $decodedString ) ;
?>
PHP 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 C:\Users\borre\OneDrive\work\torn\apitest.php on line 4
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 C:\Users\borre\OneDrive\work\torn\apitest.php on line 4
PHP Warning: file_get_contents(): Failed to enable crypto in C:\Users\borre\OneDrive\work\torn\apitest.php on line 4
Warning: file_get_contents(): Failed to enable crypto in C:\Users\borre\OneDrive\work\torn\apitest.php on line 4
PHP Warning: file_get_contents(https://api.torn.com/faction/16335?selections=basic&key=aaa): failed to open stream: operation failed in C:\Users\borre\OneDrive\work\torn\apitest.php on line 4
Warning: file_get_contents(https://api.torn.com/faction/16335?selections=basic&key=aaa): failed to open stream: operation failed in C:\Users\borre\OneDrive\work\torn\apitest.php on line 4