I use a proxy server in PHP via curl
or httpie
.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXYPORT, 80);
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password');
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$html = curl_exec($ch);
curl_close($ch);
When executing the script, the connection to the proxy server still exists. Thus, if running another script after 3s, the proxy authentication is refused because it has already connected somewhere else.
How can I fully disconnect from the proxy server by curl_close
to make the proxy available for other scripts?