/**
* HTTP API: WP_Http_Curl class
*
* @package WordPress
* @subpackage HTTP
* @since 4.4.0
*/
/**
* Core class used to integrate Curl as an HTTP transport.
*
* HTTP request method uses Curl extension to retrieve the url.
*
* Requires the Curl extension to be installed.
*
* @since 2.7.0
* @deprecated 6.4.0 Use WP_Http
* @see WP_Http
*/
#[AllowDynamicProperties]
class WP_Http_Curl {
/**
* Temporary header storage for during requests.
*
* @since 3.2.0
* @var string
*/
private $headers = '';
/**
* Temporary body storage for during requests.
*
* @since 3.6.0
* @var string
*/
private $body = '';
/**
* The maximum amount of data to receive from the remote server.
*
* @since 3.6.0
* @var int|false
*/
private $max_body_length = false;
/**
* The file resource used for streaming to file.
*
* @since 3.6.0
* @var resource|false
*/
private $stream_handle = false;
/**
* The total bytes written in the current request.
*
* @since 4.1.0
* @var int
*/
private $bytes_written_total = 0;
/**
* Send a HTTP request to a URI using cURL extension.
*
* @since 2.7.0
*
* @param string $url The request URL.
* @param string|array $args Optional. Override the defaults.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
*/
public function request( $url, $args = array() ) {
$defaults = array(
'method' => 'GET',
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => null,
'cookies' => array(),
'decompress' => false,
'stream' => false,
'filename' => null,
);
$parsed_args = wp_parse_args( $args, $defaults );
if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
$parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
unset( $parsed_args['headers']['User-Agent'] );
} elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
$parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
unset( $parsed_args['headers']['user-agent'] );
}
// Construct Cookie: header if any cookies are set.
WP_Http::buildCookieHeader( $parsed_args );
$handle = curl_init();
// cURL offers really easy proxy support.
$proxy = new WP_HTTP_Proxy();
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
if ( $proxy->use_authentication() ) {
curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
}
}
$is_local = isset( $parsed_args['local'] ) && $parsed_args['local'];
$ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify'];
if ( $is_local ) {
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
} elseif ( ! $is_local ) {
/** This filter is documented in wp-includes/class-wp-http.php */
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
}
/*
* CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since.
* a value of 0 will allow an unlimited timeout.
*/
$timeout = (int) ceil( $parsed_args['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_URL, $url );
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( true === $ssl_verify ) ? 2 : false );
curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
if ( $ssl_verify ) {
curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] );
}
curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] );
/*
* The option doesn't work with safe mode or when open_basedir is set, and there's
* a bug #17490 with redirected POST requests, so handle redirections outside Curl.
*/
curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
switch ( $parsed_args['method'] ) {
case 'HEAD':
curl_setopt( $handle, CURLOPT_NOBODY, true );
break;
case 'POST':
curl_setopt( $handle, CURLOPT_POST, true );
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
break;
case 'PUT':
curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
break;
default:
curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $parsed_args['method'] );
if ( ! is_null( $parsed_args['body'] ) ) {
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
}
break;
}
if ( true === $parsed_args['blocking'] ) {
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) );
}
curl_setopt( $handle, CURLOPT_HEADER, false );
if ( isset( $parsed_args['limit_response_size'] ) ) {
$this->max_body_length = (int) $parsed_args['limit_response_size'];
} else {
$this->max_body_length = false;
}
// If streaming to a file open a file handle, and setup our curl streaming handler.
if ( $parsed_args['stream'] ) {
if ( ! WP_DEBUG ) {
$this->stream_handle = @fopen( $parsed_args['filename'], 'w+' );
} else {
$this->stream_handle = fopen( $parsed_args['filename'], 'w+' );
}
if ( ! $this->stream_handle ) {
return new WP_Error(
'http_request_failed',
sprintf(
/* translators: 1: fopen(), 2: File name. */
__( 'Could not open handle for %1$s to %2$s.' ),
'fopen()',
$parsed_args['filename']
)
);
}
} else {
$this->stream_handle = false;
}
if ( ! empty( $parsed_args['headers'] ) ) {
// cURL expects full header strings in each element.
$headers = array();
foreach ( $parsed_args['headers'] as $name => $value ) {
$headers[] = "{$name}: $value";
}
curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
}
if ( '1.0' === $parsed_args['httpversion'] ) {
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
} else {
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
}
/**
* Fires before the cURL request is executed.
*
* Cookies are not currently handled by the HTTP API. This action allows
* plugins to handle cookies themselves.
*
* @since 2.8.0
*
* @param resource $handle The cURL handle returned by curl_init() (passed by reference).
* @param array $parsed_args The HTTP request arguments.
* @param string $url The request URL.
*/
do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) );
// We don't need to return the body, so don't. Just execute request and return.
if ( ! $parsed_args['blocking'] ) {
curl_exec( $handle );
$curl_error = curl_error( $handle );
if ( $curl_error ) {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return new WP_Error( 'http_request_failed', $curl_error );
}
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
}
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return array(
'headers' => array(),
'body' => '',
'response' => array(
'code' => false,
'message' => false,
),
'cookies' => array(),
);
}
curl_exec( $handle );
$processed_headers = WP_Http::processHeaders( $this->headers, $url );
$body = $this->body;
$bytes_written_total = $this->bytes_written_total;
$this->headers = '';
$this->body = '';
$this->bytes_written_total = 0;
$curl_error = curl_errno( $handle );
// If an error occurred, or, no response.
if ( $curl_error || ( 0 === strlen( $body ) && empty( $processed_headers['headers'] ) ) ) {
if ( CURLE_WRITE_ERROR /* 23 */ === $curl_error ) {
if ( ! $this->max_body_length || $this->max_body_length !== $bytes_written_total ) {
if ( $parsed_args['stream'] ) {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
fclose( $this->stream_handle );
return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
} else {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return new WP_Error( 'http_request_failed', curl_error( $handle ) );
}
}
} else {
$curl_error = curl_error( $handle );
if ( $curl_error ) {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return new WP_Error( 'http_request_failed', $curl_error );
}
}
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) {
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
}
}
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
curl_close( $handle );
}
if ( $parsed_args['stream'] ) {
fclose( $this->stream_handle );
}
$response = array(
'headers' => $processed_headers['headers'],
'body' => null,
'response' => $processed_headers['response'],
'cookies' => $processed_headers['cookies'],
'filename' => $parsed_args['filename'],
);
// Handle redirects.
$redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response );
if ( false !== $redirect_response ) {
return $redirect_response;
}
if ( true === $parsed_args['decompress']
&& true === WP_Http_Encoding::should_decode( $processed_headers['headers'] )
) {
$body = WP_Http_Encoding::decompress( $body );
}
$response['body'] = $body;
return $response;
}
/**
* Grabs the headers of the cURL request.
*
* Each header is sent individually to this callback, and is appended to the `$header` property
* for temporary storage.
*
* @since 3.2.0
*
* @param resource $handle cURL handle.
* @param string $headers cURL request headers.
* @return int Length of the request headers.
*/
private function stream_headers( $handle, $headers ) {
$this->headers .= $headers;
return strlen( $headers );
}
/**
* Grabs the body of the cURL request.
*
* The contents of the document are passed in chunks, and are appended to the `$body`
* property for temporary storage. Returning a length shorter than the length of
* `$data` passed in will cause cURL to abort the request with `CURLE_WRITE_ERROR`.
*
* @since 3.6.0
*
* @param resource $handle cURL handle.
* @param string $data cURL request body.
* @return int Total bytes of data written.
*/
private function stream_body( $handle, $data ) {
$data_length = strlen( $data );
if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) {
$data_length = ( $this->max_body_length - $this->bytes_written_total );
$data = substr( $data, 0, $data_length );
}
if ( $this->stream_handle ) {
$bytes_written = fwrite( $this->stream_handle, $data );
} else {
$this->body .= $data;
$bytes_written = $data_length;
}
$this->bytes_written_total += $bytes_written;
// Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
return $bytes_written;
}
/**
* Determines whether this class can be used for retrieving a URL.
*
* @since 2.7.0
*
* @param array $args Optional. Array of request arguments. Default empty array.
* @return bool False means this class can not be used, true means it can.
*/
public static function test( $args = array() ) {
if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
return false;
}
$is_ssl = isset( $args['ssl'] ) && $args['ssl'];
if ( $is_ssl ) {
$curl_version = curl_version();
// Check whether this cURL version support SSL requests.
if ( ! ( CURL_VERSION_SSL & $curl_version['features'] ) ) {
return false;
}
}
/**
* Filters whether cURL can be used as a transport for retrieving a URL.
*
* @since 2.7.0
*
* @param bool $use_class Whether the class can be used. Default true.
* @param array $args An array of request arguments.
*/
return apply_filters( 'use_curl_transport', true, $args );
}
}
Mastercard를 이용한 온라인 카지노 사이트의 편리함과 장점 – Shweta Poddar Weddings Photography
Mastercard를 이용한 온라인 카지노 사이트의 편리함과 장점
온라인 상의 카지노는 게임 부문을 혁신시켰습니다, 편리함과 가용성을 세계적으로 플레이어에게 사용할 수 있게 하고 있습니다.혁신의 도래로, 플레이어들은 자기 자신만의 집에서나 외출 중에 휴대 전화을 통하여 좋아하는 카지노 사이트 게임을 즐길 수 있습니다.온라인 상의 카지노에서 가장 인기 있는 지불 기법 중 하나는 Mastercard입니다.이 포스트에서, 우리는 온라인 도박장에서 Mastercard를 사용하는 이점을 탐구하고 플레이어들을 위한 유용한 정보를 제공할 것입니다.
안전하고 보호된 구매
온라인 상의 거래에 관하여, 보안은 항상 가장 중요한 관심사입니다. Mastercard는 혁신적인 안전 조치로 알려져 있습니다.온라인 상의 도박 설립는 Mastercard를 지불 접근으로 승인합니다.개인과 관련된 및 금융 정보을 보호하고 있습니다.인터넷 상의 카지노 사이트는 Mastercard를 결제 기법으로 승인하고 있습니다.안전한 파일 암호화 혁신을 사용하고 있습니다 데이터를 안전하게 보호하여 플레이어들이 선호하는 카지노 비디오 게임을 감상할 때 마음의 평화를 제공하기 위해 제공하고 있습니다.
게다가, Mastercard는 책임 무 정책을 제공하고 있습니다, 말하자면, 허가받지 않은 요금이 계정에 발생할 경우, 책임을 지지 않습니다.이 정책은 추가적인 방어 층을 추가로 제공하여 온라인 도박장 플레이어들에게 중요한 지불 옵션으로 만들어 있습니다.
이와 더불어, 온라인 상의 도박 설립는 종종 엄밀한 확인 절차를 마련하여 부정 행위 활동을 방지합니다.이는 지불 기법으로 Mastercard를 사용할 때 입금 개인과 관련된 및 예치 거래는 합법적이고 안전하게 보호된 것으로 보장됩니다.
편리성과 접근성
Mastercard를 인터넷 상의 카지노 사이트에서 사용하는 중요한 혜택 중 하나는 용이함입니다.대부분의 플레이어는 이미 지갑에 Mastercard를 소유하고 있어 익숙하고 빠르게 접근할 수 있는 지불 방법입니다.단 몇 번의 클릭 만으로 빠르게 예치금을 도박장 계정에 넣고 곧바로 플레이할 수 있습니다.
Mastercard 거래는 또한 빠르게 처리되므로, 연속적인 비디오 게임 세션을 즐길 수 있게 해줍니다.보통 즉시 입금이 가능하므로, 곧바로 즐길 수 있습니다.출금은 조금 더 오래 걸릴 수 있으며, 인터넷 상의 도박 설립의 처리 시간에 따라 조금 더 느리거나 정산 방법과 비교했을 때 비교적 빠르다는 것입니다.
게다가, Mastercard는 주요한 인터넷 상의 카지노 사이트에서 광범위하게 승인되고 있으며, 이는 신뢰할 수 있는 탐색할 수 있는 선택을 찾을 수 있다는 것을 의미합니다.
Mastercard는 대부분의 온라인 상의 카지노 사이트에서 승인됩니다
편리하고 사용하기 쉬운 결제 방법
빠른 예금 및 처리 시간을 제공합니다
보상 및 인센티브
온라인 상의 카지노에서 Mastercard를 이용하는 것은 추가적인 혜택을 제공할 수 있습니다 형태에서의 인센티브 및 혜택.많은 온라인 상의 카지노 사이트는 충성도 프로그램 또는 VIP 시스템을 보상하며 플레이어들에게 지속적인 고객에게 적립할 수 있습니다 헌신도 포인트를 적립하거나 독특한 보너스 혜택을 받을 수 있습니다, 이러한 보상는 무료 회전, 현금 환급 제공 등의 프로모션에 참여할 수 있습니다, 대회에 참여할 수 있습니다.이런 프로모션을 활용하면 승리할 기회를 최적화하며 추가적인 가치를 제공합니다 온라인 상의 카지노 경험에 가치를 더합니다.
결론
온라인 카지노 사이트는 Mastercard를 정산 방법으로 승인하여 플레이어들에게 안전한 안전하게 보호된 그리고 편리한 방법을 제공합니다 좋아하는 카지노 사이트 게임을 즐길 수 있는.고급 안전 단계, 빠른 처리 시간 및 넓은 승인, Mastercard는 신뢰할 수 있는 및 신뢰할 수 있는 인터넷 상의 도박장 트랜잭션의 옵션을 제공합니다.그리고, 혜택 및 인센티브를 적립할 기회를 제공합니다 게이머들을 위한 일반적인 게임 경험을 향상시키며.그러므로, 숙련된 온라인 상의 도박 설립 열성팬 또는 단지 시작하는, Mastercard를 인터넷 상의 카지노에 사용하는 것은 영리한 선택입니다.