$options['hooks'
]->
dispatch('fsockopen.before_request'
);
$url_parts =
parse_url($url);
if (empty($url_parts)) { throw new Exception('Invalid URL.', 'invalidurl',
$url);
} $host =
$url_parts['host'
];
$context =
stream_context_create();
$verifyname = false;
$case_insensitive_headers =
new CaseInsensitiveDictionary($headers);
// HTTPS support
if (isset($url_parts['scheme'
]) &&
strtolower($url_parts['scheme'
]) === 'https'
) { $remote_socket = 'ssl://' .
$host;
if (!
isset($url_parts['port'
])) { $url_parts['port'
] = Port::HTTPS;
} $context_options =
[ 'verify_peer' => true,
'capture_peer_cert' => true,
];