From 16380527e152a2a5640a3a62f885ffecb87175e7 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Thu, 12 Jan 2023 07:51:07 -0800 Subject: [PATCH] Fix #750: Implement abstract class BaseCurl for Curl and MultiCurl --- src/Curl/BaseCurl.php | 395 +++++++++++++++++++++++++++++++++++++++++ src/Curl/Curl.php | 365 +------------------------------------ src/Curl/MultiCurl.php | 359 +------------------------------------ 3 files changed, 399 insertions(+), 720 deletions(-) create mode 100644 src/Curl/BaseCurl.php diff --git a/src/Curl/BaseCurl.php b/src/Curl/BaseCurl.php new file mode 100644 index 0000000..1514ca6 --- /dev/null +++ b/src/Curl/BaseCurl.php @@ -0,0 +1,395 @@ +beforeSendCallback = $callback; + } + + abstract public function close(); + + /** + * Complete + * + * @access public + * @param $callback callable|null + */ + public function complete($callback) + { + $this->completeCallback = $callback; + } + + /** + * Disable Timeout + * + * @access public + */ + public function disableTimeout() + { + $this->setTimeout(null); + } + + /** + * Error + * + * @access public + * @param $callback callable|null + */ + public function error($callback) + { + $this->errorCallback = $callback; + } + + /** + * Get Opt + * + * @access public + * @param $option + * + * @return mixed + */ + public function getOpt($option) + { + return isset($this->options[$option]) ? $this->options[$option] : null; + } + + /** + * Remove Header + * + * Remove an internal header from the request. + * Using `curl -H "Host:" ...' is equivalent to $curl->removeHeader('Host');. + * + * @access public + * @param $key + */ + public function removeHeader($key) + { + $this->setHeader($key, ''); + } + + /** + * Set auto referer + * + * @access public + */ + public function setAutoReferer($auto_referer = true) + { + $this->setAutoReferrer($auto_referer); + } + + /** + * Set auto referrer + * + * @access public + */ + public function setAutoReferrer($auto_referrer = true) + { + $this->setOpt(CURLOPT_AUTOREFERER, $auto_referrer); + } + + /** + * Set Basic Authentication + * + * @access public + * @param $username + * @param $password + */ + public function setBasicAuthentication($username, $password = '') + { + $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); + } + + /** + * Set Connect Timeout + * + * @access public + * @param $seconds + */ + public function setConnectTimeout($seconds) + { + $this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds); + } + + abstract public function setCookie($key, $value); + abstract public function setCookieFile($cookie_file); + abstract public function setCookieJar($cookie_jar); + abstract public function setCookieString($string); + abstract public function setCookies($cookies); + + /** + * Set Digest Authentication + * + * @access public + * @param $username + * @param $password + */ + public function setDigestAuthentication($username, $password = '') + { + $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); + } + + /** + * Set File + * + * @access public + * @param $file + */ + public function setFile($file) + { + $this->setOpt(CURLOPT_FILE, $file); + } + + /** + * Set follow location + * + * @access public + */ + public function setFollowLocation($follow_location = true) + { + $this->setOpt(CURLOPT_FOLLOWLOCATION, $follow_location); + } + + /** + * Set forbid reuse + * + * @access public + */ + public function setForbidReuse($forbid_reuse = true) + { + $this->setOpt(CURLOPT_FORBID_REUSE, $forbid_reuse); + } + + abstract public function setHeader($key, $value); + abstract public function setHeaders($headers); + + /** + * Set Interface + * + * The name of the outgoing network interface to use. + * This can be an interface name, an IP address or a host name. + * + * @access public + * @param $interface + */ + public function setInterface($interface) + { + $this->setOpt(CURLOPT_INTERFACE, $interface); + } + + abstract public function setJsonDecoder($mixed); + + /** + * Set maximum redirects + * + * @access public + */ + public function setMaximumRedirects($maximum_redirects) + { + $this->setOpt(CURLOPT_MAXREDIRS, $maximum_redirects); + } + + abstract public function setOpt($option, $value); + abstract public function setOpts($options); + + /** + * Set Port + * + * @access public + * @param $port + */ + public function setPort($port) + { + $this->setOpt(CURLOPT_PORT, (int) $port); + } + + /** + * Set Proxy + * + * Set an HTTP proxy to tunnel requests through. + * + * @access public + * @param $proxy - The HTTP proxy to tunnel requests through. May include port number. + * @param $port - The port number of the proxy to connect to. This port number can also be set in $proxy. + * @param $username - The username to use for the connection to the proxy. + * @param $password - The password to use for the connection to the proxy. + */ + public function setProxy($proxy, $port = null, $username = null, $password = null) + { + $this->setOpt(CURLOPT_PROXY, $proxy); + if ($port !== null) { + $this->setOpt(CURLOPT_PROXYPORT, $port); + } + if ($username !== null && $password !== null) { + $this->setOpt(CURLOPT_PROXYUSERPWD, $username . ':' . $password); + } + } + + /** + * Set Proxy Auth + * + * Set the HTTP authentication method(s) to use for the proxy connection. + * + * @access public + * @param $auth + */ + public function setProxyAuth($auth) + { + $this->setOpt(CURLOPT_PROXYAUTH, $auth); + } + + /** + * Set Proxy Tunnel + * + * Set the proxy to tunnel through HTTP proxy. + * + * @access public + * @param $tunnel boolean + */ + public function setProxyTunnel($tunnel = true) + { + $this->setOpt(CURLOPT_HTTPPROXYTUNNEL, $tunnel); + } + + /** + * Set Proxy Type + * + * Set the proxy protocol type. + * + * @access public + * @param $type + */ + public function setProxyType($type) + { + $this->setOpt(CURLOPT_PROXYTYPE, $type); + } + + /** + * Set Range + * + * @access public + * @param $range + */ + public function setRange($range) + { + $this->setOpt(CURLOPT_RANGE, $range); + } + + /** + * Set Referer + * + * @access public + * @param $referer + */ + public function setReferer($referer) + { + $this->setReferrer($referer); + } + + /** + * Set Referrer + * + * @access public + * @param $referrer + */ + public function setReferrer($referrer) + { + $this->setOpt(CURLOPT_REFERER, $referrer); + } + + abstract public function setRetry($mixed); + + /** + * Set Timeout + * + * @access public + * @param $seconds + */ + public function setTimeout($seconds) + { + $this->setOpt(CURLOPT_TIMEOUT, $seconds); + } + + abstract public function setUrl($url, $mixed_data = ''); + + /** + * Set User Agent + * + * @access public + * @param $user_agent + */ + public function setUserAgent($user_agent) + { + $this->setOpt(CURLOPT_USERAGENT, $user_agent); + } + + abstract public function setXmlDecoder($mixed); + abstract public function stop(); + + /** + * Success + * + * @access public + * @param $callback callable|null + */ + public function success($callback) + { + $this->successCallback = $callback; + } + + abstract public function unsetHeader($key); + + /** + * Unset Proxy + * + * Disable use of the proxy. + * + * @access public + */ + public function unsetProxy() + { + $this->setOpt(CURLOPT_PROXY, null); + } + + /** + * Verbose + * + * @access public + * @param bool $on + * @param resource|string $output + */ + public function verbose($on = true, $output = 'STDERR') + { + if ($output === 'STDERR') { + if (!defined('STDERR')) { + define('STDERR', fopen('php://stderr', 'wb')); + } + $output = STDERR; + } + + // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side + // effect of causing Curl::requestHeaders to be empty. + if ($on) { + $this->setOpt(CURLINFO_HEADER_OUT, false); + } + $this->setOpt(CURLOPT_VERBOSE, $on); + $this->setOpt(CURLOPT_STDERR, $output); + } +} diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index f0c0dfc..b1b82db 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -3,9 +3,10 @@ namespace Curl; use Curl\ArrayUtil; +use Curl\BaseCurl; use Curl\Url; -class Curl +class Curl extends BaseCurl { const VERSION = '9.12.6'; const DEFAULT_TIMEOUT = 30; @@ -34,11 +35,7 @@ class Curl public $response = null; public $rawResponse = null; - public $beforeSendCallback = null; public $downloadCompleteCallback = null; - public $successCallback = null; - public $errorCallback = null; - public $completeCallback = null; public $fileHandle = null; public $downloadFileName = null; @@ -54,7 +51,6 @@ class Curl private $headerCallbackData; private $cookies = []; private $headers = []; - private $options = []; private $jsonDecoderArgs = []; private $jsonPattern = '/^(?:application|text)\/(?:[a-z]+(?:[\.-][0-9a-z]+){0,}[\+\.]|x-)?json(?:-[a-z]+)?/i'; @@ -138,17 +134,6 @@ class Curl $this->initialize($base_url, $options); } - /** - * Before Send - * - * @access public - * @param $callback callable|null - */ - public function beforeSend($callback) - { - $this->beforeSendCallback = $callback; - } - /** * Build Post Data * @@ -268,17 +253,6 @@ class Curl $this->defaultDecoder = null; } - /** - * Complete - * - * @access public - * @param $callback callable|null - */ - public function complete($callback) - { - $this->completeCallback = $callback; - } - /** * Progress * @@ -478,17 +452,6 @@ class Curl return true; } - /** - * Error - * - * @access public - * @param $callback callable|null - */ - public function error($callback) - { - $this->errorCallback = $callback; - } - /** * Exec * @@ -653,19 +616,6 @@ class Curl return call_user_func_array('curl_getinfo', $args); } - /** - * Get Opt - * - * @access public - * @param $option - * - * @return mixed - */ - public function getOpt($option) - { - return isset($this->options[$option]) ? $this->options[$option] : null; - } - /** * Head * @@ -844,32 +794,6 @@ class Curl return $this->exec(); } - /** - * Set Basic Authentication - * - * @access public - * @param $username - * @param $password - */ - public function setBasicAuthentication($username, $password = '') - { - $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); - } - - /** - * Set Digest Authentication - * - * @access public - * @param $username - * @param $password - */ - public function setDigestAuthentication($username, $password = '') - { - $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); - } - /** * Set Cookie * @@ -938,28 +862,6 @@ class Curl $this->progress($callback); } - /** - * Set Port - * - * @access public - * @param $port - */ - public function setPort($port) - { - $this->setOpt(CURLOPT_PORT, (int) $port); - } - - /** - * Set Connect Timeout - * - * @access public - * @param $seconds - */ - public function setConnectTimeout($seconds) - { - $this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds); - } - /** * Set Cookie String * @@ -1081,17 +983,6 @@ class Curl $this->setUserAgent($user_agent); } - /** - * Set File - * - * @access public - * @param $file - */ - public function setFile($file) - { - $this->setOpt(CURLOPT_FILE, $file); - } - /** * Set Header * @@ -1218,112 +1109,6 @@ class Curl return true; } - /** - * Set Proxy - * - * Set an HTTP proxy to tunnel requests through. - * - * @access public - * @param $proxy - The HTTP proxy to tunnel requests through. May include port number. - * @param $port - The port number of the proxy to connect to. This port number can also be set in $proxy. - * @param $username - The username to use for the connection to the proxy. - * @param $password - The password to use for the connection to the proxy. - */ - public function setProxy($proxy, $port = null, $username = null, $password = null) - { - $this->setOpt(CURLOPT_PROXY, $proxy); - if ($port !== null) { - $this->setOpt(CURLOPT_PROXYPORT, $port); - } - if ($username !== null && $password !== null) { - $this->setOpt(CURLOPT_PROXYUSERPWD, $username . ':' . $password); - } - } - - /** - * Set Proxy Auth - * - * Set the HTTP authentication method(s) to use for the proxy connection. - * - * @access public - * @param $auth - */ - public function setProxyAuth($auth) - { - $this->setOpt(CURLOPT_PROXYAUTH, $auth); - } - - /** - * Set Proxy Type - * - * Set the proxy protocol type. - * - * @access public - * @param $type - */ - public function setProxyType($type) - { - $this->setOpt(CURLOPT_PROXYTYPE, $type); - } - - /** - * Set Proxy Tunnel - * - * Set the proxy to tunnel through HTTP proxy. - * - * @access public - * @param $tunnel boolean - */ - public function setProxyTunnel($tunnel = true) - { - $this->setOpt(CURLOPT_HTTPPROXYTUNNEL, $tunnel); - } - - /** - * Unset Proxy - * - * Disable use of the proxy. - * - * @access public - */ - public function unsetProxy() - { - $this->setOpt(CURLOPT_PROXY, null); - } - - /** - * Set Range - * - * @access public - * @param $range - */ - public function setRange($range) - { - $this->setOpt(CURLOPT_RANGE, $range); - } - - /** - * Set Referer - * - * @access public - * @param $referer - */ - public function setReferer($referer) - { - $this->setReferrer($referer); - } - - /** - * Set Referrer - * - * @access public - * @param $referrer - */ - public function setReferrer($referrer) - { - $this->setOpt(CURLOPT_REFERER, $referrer); - } - /** * Set Retry * @@ -1348,27 +1133,6 @@ class Curl } } - /** - * Set Timeout - * - * @access public - * @param $seconds - */ - public function setTimeout($seconds) - { - $this->setOpt(CURLOPT_TIMEOUT, $seconds); - } - - /** - * Disable Timeout - * - * @access public - */ - public function disableTimeout() - { - $this->setTimeout(null); - } - /** * Set Url * @@ -1389,31 +1153,6 @@ class Curl $this->setOpt(CURLOPT_URL, $this->url); } - /** - * Set User Agent - * - * @access public - * @param $user_agent - */ - public function setUserAgent($user_agent) - { - $this->setOpt(CURLOPT_USERAGENT, $user_agent); - } - - /** - * Set Interface - * - * The name of the outgoing network interface to use. - * This can be an interface name, an IP address or a host name. - * - * @access public - * @param $interface - */ - public function setInterface($interface) - { - $this->setOpt(CURLOPT_INTERFACE, $interface); - } - /** * Attempt Retry * @@ -1438,17 +1177,6 @@ class Curl return $attempt_retry; } - /** - * Success - * - * @access public - * @param $callback callable|null - */ - public function success($callback) - { - $this->successCallback = $callback; - } - /** * Unset Header * @@ -1467,45 +1195,6 @@ class Curl $this->setOpt(CURLOPT_HTTPHEADER, $headers); } - /** - * Remove Header - * - * Remove an internal header from the request. - * Using `curl -H "Host:" ...' is equivalent to $curl->removeHeader('Host');. - * - * @access public - * @param $key - */ - public function removeHeader($key) - { - $this->setHeader($key, ''); - } - - /** - * Verbose - * - * @access public - * @param bool $on - * @param resource|string $output - */ - public function verbose($on = true, $output = 'STDERR') - { - if ($output === 'STDERR') { - if (!defined('STDERR')) { - define('STDERR', fopen('php://stderr', 'wb')); - } - $output = STDERR; - } - - // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side - // effect of causing Curl::requestHeaders to be empty. - if ($on) { - $this->setOpt(CURLINFO_HEADER_OUT, false); - } - $this->setOpt(CURLOPT_VERBOSE, $on); - $this->setOpt(CURLOPT_STDERR, $output); - } - /** * Diagnose * @@ -1728,56 +1417,6 @@ class Curl $this->initialize(); } - /** - * Set auto referer - * - * @access public - */ - public function setAutoReferer($auto_referer = true) - { - $this->setAutoReferrer($auto_referer); - } - - /** - * Set auto referrer - * - * @access public - */ - public function setAutoReferrer($auto_referrer = true) - { - $this->setOpt(CURLOPT_AUTOREFERER, $auto_referrer); - } - - /** - * Set follow location - * - * @access public - */ - public function setFollowLocation($follow_location = true) - { - $this->setOpt(CURLOPT_FOLLOWLOCATION, $follow_location); - } - - /** - * Set forbid reuse - * - * @access public - */ - public function setForbidReuse($forbid_reuse = true) - { - $this->setOpt(CURLOPT_FORBID_REUSE, $forbid_reuse); - } - - /** - * Set maximum redirects - * - * @access public - */ - public function setMaximumRedirects($maximum_redirects) - { - $this->setOpt(CURLOPT_MAXREDIRS, $maximum_redirects); - } - public function getCurl() { return $this->curl; diff --git a/src/Curl/MultiCurl.php b/src/Curl/MultiCurl.php index 21a8e71..db933ee 100755 --- a/src/Curl/MultiCurl.php +++ b/src/Curl/MultiCurl.php @@ -3,9 +3,10 @@ namespace Curl; use Curl\ArrayUtil; +use Curl\BaseCurl; use Curl\Url; -class MultiCurl +class MultiCurl extends BaseCurl { public $baseUrl = null; public $multiCurl = null; @@ -30,16 +31,10 @@ class MultiCurl private $intervalSeconds = null; private $unit = null; - private $beforeSendCallback = null; - private $successCallback = null; - private $errorCallback = null; - private $completeCallback = null; - private $retry = null; private $cookies = []; private $headers = []; - private $options = []; private $instanceSpecificOptions = []; private $proxies = null; @@ -372,17 +367,6 @@ class MultiCurl return $curl; } - /** - * Before Send - * - * @access public - * @param $callback callable|null - */ - public function beforeSend($callback) - { - $this->beforeSendCallback = $callback; - } - /** * Close * @@ -400,54 +384,6 @@ class MultiCurl $this->multiCurl = null; } - /** - * Complete - * - * @access public - * @param $callback callable|null - */ - public function complete($callback) - { - $this->completeCallback = $callback; - } - - /** - * Error - * - * @access public - * @param $callback callable|null - */ - public function error($callback) - { - $this->errorCallback = $callback; - } - - /** - * Get Opt - * - * @access public - * @param $option - * - * @return mixed - */ - public function getOpt($option) - { - return isset($this->options[$option]) ? $this->options[$option] : null; - } - - /** - * Set Basic Authentication - * - * @access public - * @param $username - * @param $password - */ - public function setBasicAuthentication($username, $password = '') - { - $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); - } - /** * Set Concurrency * @@ -459,19 +395,6 @@ class MultiCurl $this->concurrency = $concurrency; } - /** - * Set Digest Authentication - * - * @access public - * @param $username - * @param $password - */ - public function setDigestAuthentication($username, $password = '') - { - $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password); - } - /** * Set Cookie * @@ -497,28 +420,6 @@ class MultiCurl } } - /** - * Set Port - * - * @access public - * @param $port - */ - public function setPort($port) - { - $this->setOpt(CURLOPT_PORT, (int) $port); - } - - /** - * Set Connect Timeout - * - * @access public - * @param $seconds - */ - public function setConnectTimeout($seconds) - { - $this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds); - } - /** * Set Cookie String * @@ -552,17 +453,6 @@ class MultiCurl $this->setOpt(CURLOPT_COOKIEJAR, $cookie_jar); } - /** - * Set File - * - * @access public - * @param $file - */ - public function setFile($file) - { - $this->setOpt(CURLOPT_FILE, $file); - } - /** * Set Header * @@ -636,28 +526,6 @@ class MultiCurl } } - /** - * Set Proxy - * - * Set an HTTP proxy to tunnel requests through. - * - * @access public - * @param $proxy - The HTTP proxy to tunnel requests through. May include port number. - * @param $port - The port number of the proxy to connect to. This port number can also be set in $proxy. - * @param $username - The username to use for the connection to the proxy. - * @param $password - The password to use for the connection to the proxy. - */ - public function setProxy($proxy, $port = null, $username = null, $password = null) - { - $this->setOpt(CURLOPT_PROXY, $proxy); - if ($port !== null) { - $this->setOpt(CURLOPT_PROXYPORT, $port); - } - if ($username !== null && $password !== null) { - $this->setOpt(CURLOPT_PROXYUSERPWD, $username . ':' . $password); - } - } - /** * Set Proxies * @@ -673,57 +541,6 @@ class MultiCurl $this->proxies = $proxies; } - /** - * Set Proxy Auth - * - * Set the HTTP authentication method(s) to use for the proxy connection. - * - * @access public - * @param $auth - */ - public function setProxyAuth($auth) - { - $this->setOpt(CURLOPT_PROXYAUTH, $auth); - } - - /** - * Set Proxy Type - * - * Set the proxy protocol type. - * - * @access public - * @param $type - */ - public function setProxyType($type) - { - $this->setOpt(CURLOPT_PROXYTYPE, $type); - } - - /** - * Set Proxy Tunnel - * - * Set the proxy to tunnel through HTTP proxy. - * - * @access public - * @param $tunnel boolean - */ - public function setProxyTunnel($tunnel = true) - { - $this->setOpt(CURLOPT_HTTPPROXYTUNNEL, $tunnel); - } - - /** - * Unset Proxy - * - * Disable use of the proxy. - * - * @access public - */ - public function unsetProxy() - { - $this->setOpt(CURLOPT_PROXY, null); - } - /** * Set Opt * @@ -761,17 +578,6 @@ class MultiCurl } } - /** - * Set Range - * - * @access public - * @param $range - */ - public function setRange($range) - { - $this->setOpt(CURLOPT_RANGE, $range); - } - /** * Set Rate Limit * @@ -824,28 +630,6 @@ class MultiCurl $this->unit = $unit; } - /** - * Set Referer - * - * @access public - * @param $referer - */ - public function setReferer($referer) - { - $this->setReferrer($referer); - } - - /** - * Set Referrer - * - * @access public - * @param $referrer - */ - public function setReferrer($referrer) - { - $this->setOpt(CURLOPT_REFERER, $referrer); - } - /** * Set Retry * @@ -865,27 +649,6 @@ class MultiCurl $this->retry = $mixed; } - /** - * Set Timeout - * - * @access public - * @param $seconds - */ - public function setTimeout($seconds) - { - $this->setOpt(CURLOPT_TIMEOUT, $seconds); - } - - /** - * Disable Timeout - * - * @access public - */ - public function disableTimeout() - { - $this->setTimeout(null); - } - /** * Set Url * @@ -906,31 +669,6 @@ class MultiCurl $this->setOpt(CURLOPT_URL, $this->baseUrl); } - /** - * Set User Agent - * - * @access public - * @param $user_agent - */ - public function setUserAgent($user_agent) - { - $this->setOpt(CURLOPT_USERAGENT, $user_agent); - } - - /** - * Set Interface - * - * The name of the outgoing network interface to use. - * This can be an interface name, an IP address or a host name. - * - * @access public - * @param $interface - */ - public function setInterface($interface) - { - $this->setOpt(CURLOPT_INTERFACE, $interface); - } - /** * Start * @@ -1067,17 +805,6 @@ class MultiCurl } } - /** - * Success - * - * @access public - * @param $callback callable|null - */ - public function success($callback) - { - $this->successCallback = $callback; - } - /** * Unset Header * @@ -1091,88 +818,6 @@ class MultiCurl unset($this->headers[$key]); } - /** - * Remove Header - * - * Remove an internal header from the request. - * Using `curl -H "Host:" ...' is equivalent to $curl->removeHeader('Host');. - * - * @access public - * @param $key - */ - public function removeHeader($key) - { - $this->setHeader($key, ''); - } - - /** - * Verbose - * - * @access public - * @param bool $on - * @param resource $output - */ - public function verbose($on = true, $output = STDERR) - { - // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side - // effect of causing Curl::requestHeaders to be empty. - if ($on) { - $this->setOpt(CURLINFO_HEADER_OUT, false); - } - $this->setOpt(CURLOPT_VERBOSE, $on); - $this->setOpt(CURLOPT_STDERR, $output); - } - - /** - * Set auto referer - * - * @access public - */ - public function setAutoReferer($auto_referer = true) - { - $this->setAutoReferrer($auto_referer); - } - - /** - * Set auto referrer - * - * @access public - */ - public function setAutoReferrer($auto_referrer = true) - { - $this->setOpt(CURLOPT_AUTOREFERER, $auto_referrer); - } - - /** - * Set follow location - * - * @access public - */ - public function setFollowLocation($follow_location = true) - { - $this->setOpt(CURLOPT_FOLLOWLOCATION, $follow_location); - } - - /** - * Set forbid reuse - * - * @access public - */ - public function setForbidReuse($forbid_reuse = true) - { - $this->setOpt(CURLOPT_FORBID_REUSE, $forbid_reuse); - } - - /** - * Set maximum redirects - * - * @access public - */ - public function setMaximumRedirects($maximum_redirects) - { - $this->setOpt(CURLOPT_MAXREDIRS, $maximum_redirects); - } - /** * Set request time accuracy *