summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class12
1 files changed, 6 insertions, 6 deletions
diff --git a/it_url.class b/it_url.class
index aa2ce4a..cbf390a 100644
--- a/it_url.class
+++ b/it_url.class
@@ -268,7 +268,7 @@ static function curl_opts($p=array())
function request($p=array())
{
- static $curl;
+ static $curl_handles = [];
$url = $this;
if ($p['url'])
$this->__construct($p['url']);
@@ -282,8 +282,8 @@ function request($p=array())
$stderr = it::fopen("php://memory", "r+");
$opts += [CURLOPT_STDERR => $stderr, CURLOPT_VERBOSE => 1];
}
- if (!isset($curl))
- $curl = curl_init($url->url);
+ if (!($curl = $curl_handles[getmypid()]))
+ $curl = $curl_handles[getmypid()] = curl_init($url->url);
else
{
curl_reset($curl);
@@ -380,7 +380,7 @@ function request($p=array())
*/
static function get_multi($p=null)
{
- static $mh;
+ static $curl_multi_handles = [];
$p += array('retries' => 1);
EDC('req', $p);
@@ -390,8 +390,8 @@ static function get_multi($p=null)
$opts = self::curl_opts($p);
- if (!isset($mh))
- $mh = curl_multi_init();
+ if (!($mh = $curl_multi_handles[getmypid()]))
+ $mh = $curl_multi_handles[getmypid()] = curl_multi_init();
$keys = $handles = $urls = $retries = [];
$addhandle = function ($key, $url) use (&$keys, &$handles, &$urls, $opts, $mh) {