Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CurlMultiHandler example
public
static
function
chooseHandler
(
)
: callable
{
$handler
= null;
if
(
\
defined
(
'CURLOPT_CUSTOMREQUEST'
)
)
{
if
(
\
function_exists
(
'curl_multi_exec'
)
&& \
function_exists
(
'curl_exec'
)
)
{
$handler
= Proxy::
wrapSync
(
new
CurlMultiHandler
(
)
,
new
CurlHandler
(
)
)
;
}
elseif
(
\
function_exists
(
'curl_exec'
)
)
{
$handler
=
new
CurlHandler
(
)
;
}
elseif
(
\
function_exists
(
'curl_multi_exec'
)
)
{
$handler
=
new
CurlMultiHandler
(
)
;
}
}
if
(
\
ini_get
(
'allow_url_fopen'
)
)
{
$handler
=
$handler
? Proxy::
wrapStreaming
(
$handler
,
new
StreamHandler
(
)
)
:
new
StreamHandler
(
)
;
}