Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Http example
if
(
is_array
(
$options
[
'auth'
]
)
)
{
$options
[
'auth'
]
=
new
Basic
(
$options
[
'auth'
]
)
;
}
if
(
$options
[
'auth'
]
!== false
)
{
$options
[
'auth'
]
->
register
(
$options
[
'hooks'
]
)
;
}
if
(
is_string
(
$options
[
'proxy'
]
)
||
is_array
(
$options
[
'proxy'
]
)
)
{
$options
[
'proxy'
]
=
new
Http
(
$options
[
'proxy'
]
)
;
}
if
(
$options
[
'proxy'
]
!== false
)
{
$options
[
'proxy'
]
->
register
(
$options
[
'hooks'
]
)
;
}
if
(
is_array
(
$options
[
'cookies'
]
)
)
{
$options
[
'cookies'
]
=
new
Jar
(
$options
[
'cookies'
]
)
;
}
elseif
(
empty
(
$options
[
'cookies'
]
)
)
{
$options
[
'cookies'
]
=
new
Jar
(
)
;
}
$options
[
'verify'
]
=
apply_filters
(
'https_ssl_verify',
$options
[
'verify'
]
,
$url
)
;
// Check for proxies.
$proxy
=
new
WP_HTTP_Proxy
(
)
;
if
(
$proxy
->
is_enabled
(
)
&&
$proxy
->
send_through_proxy
(
$url
)
)
{
$options
[
'proxy'
]
=
new
WpOrg\Requests\Proxy\
Http
(
$proxy
->
host
(
)
. ':' .
$proxy
->
port
(
)
)
;
if
(
$proxy
->
use_authentication
(
)
)
{
$options
[
'proxy'
]
->use_authentication = true;
$options
[
'proxy'
]
->user =
$proxy
->
username
(
)
;
$options
[
'proxy'
]
->pass =
$proxy
->
password
(
)
;
}
}
// Avoid issues where mbstring.func_overload is enabled.
mbstring_binary_safe_encoding
(
)
;