[web-news] master: Allow for posting with self-signed certificates
| From: | Derick Rethans | Date: | Fri, 27 Mar 2026 11:45:46 +0000 |
| Subject: | [web-news] master: Allow for posting with self-signed certificates | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-33627@lists.php.net to get a copy of this message | ||
Author: Derick Rethans (derickr)
Date: 2026-03-27T11:45:14Z
Commit: https://github.com/php/web-news/commit/5d8bd51b1dc74bfe88fa0485f898e2c3a68bff40
Raw diff: https://github.com/php/web-news/commit/5d8bd51b1dc74bfe88fa0485f898e2c3a68bff40.diff
Allow for posting with self-signed certificates
Changed paths:
M lib/common.php
Diff:
diff --git a/lib/common.php b/lib/common.php
index 8c680fc..750393d 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -92,8 +92,12 @@ function posttohost($url, $data)
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data,
];
+ $sslOpts = [
+ 'allow_self_signed' => true, // this connects internally
+ 'verify_peer_name' => false, // our self-signed cert is for
'php.net'
+ ];
- $ctx = stream_context_create(['http' => $opts]);
+ $ctx = stream_context_create(['http' => $opts, 'ssl' => $sslOpts]);
return file_get_contents($url, false, $ctx);
}