/** * 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); } }
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); } } }