本文整理匯總了PHP中Curl\Curl::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Curl::reset方法的具體用法?PHP Curl::reset怎麽用?PHP Curl::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Curl\Curl
的用法示例。
在下文中一共展示了Curl::reset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: applyCurlOptions
/**
* Apply cURL options
*/
private function applyCurlOptions()
{
$this->curl->reset();
$this->curl->setUserAgent('Shopello-PHP API Client/1.0');
$this->curl->setHeader('X-API-KEY', $this->apiKey);
$this->curl->setOpt(CURLOPT_ENCODING, 'gzip');
$this->curl->setOpt(CURLOPT_HEADER, false);
$this->curl->setOpt(CURLOPT_NOBODY, false);
$this->curl->setOpt(CURLOPT_CONNECTTIMEOUT, 3);
$this->curl->setOpt(CURLOPT_TIMEOUT, 300);
foreach ($this->curlOptions as $key => $value) {
$this->curl->setOpt($key, $value);
}
}
示例2: parse
public function parse()
{
$curl = new Curl();
foreach ($this->origins as $origin) {
foreach ($this->queries as $query) {
shuffle($this->userAgents);
$curl->reset();
$curl->setUserAgent($this->userAgents[0]);
$curl->setOpt(CURLOPT_RETURNTRANSFER, true);
$curl->get($origin, [self::QUERY_GET_PARAM => $query]);
var_dump($curl->response);
}
}
}