-2

I have a an API I'm using a variety of methods on. GET works fine as do the others I am testing. When using PATCH, it gives errors despite the documentation showing it's enabled.

The errors are:

Warning: file_get_contents(): SSL: Connection reset by peer in upload.php on line 20

Warning: file_get_contents(https://api-domain/answers/331): failed to open stream: HTTP request failed! in oracle_upload.php on line 20
Error

Line 20 is

$response = file_get_contents('https://api-domain/answers/331', FALSE, $content)

As for the $content variable:

$postData = array(        
    'solution' => 'Testing 123'
);

$context = stream_context_create(array(
    'http' => array(
        'method' => 'PATCH',
        'header' => "Authorization: Basic dXNlcjpwYXNz\r\nContent-Type: application/json\r\n",
        'content' => json_encode($postData)
    ),
    "ssl"=>array(
        "allow_self_signed"=>true,
        "verify_peer"=>false,
        "verify_peer_name"=>false
    )
));

Please note, https://api-domain is a fake addy Thanks

Manoj Sharma
  • 1,467
  • 2
  • 13
  • 20
pee2pee
  • 3,619
  • 7
  • 52
  • 133

1 Answers1

0

In your php.ini file change this line or add.

extension=php_openssl.dll

allow_url_fopen = On

XAF
  • 1,462
  • 1
  • 11
  • 22