diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php index 6cfdc24..432d16c 100644 --- a/lib/TikTok/Api.php +++ b/lib/TikTok/Api.php @@ -588,16 +588,18 @@ private function remote_call($url = "", $isJson = true, $headers = ['Referer: ht CURLOPT_COOKIEFILE => $this->_config['cookie_file'], ]; - curl_setopt_array($ch, $options); - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - } if ($this->_config['proxy-host'] && $this->_config['proxy-port']) { - curl_setopt($ch, CURLOPT_PROXY, $this->_config['proxy-host'] . ":" . $this->_config['proxy-port']); + $options[CURLOPT_PROXY] = $this->_config['proxy-host'] . ':' . $this->_config['proxy-port']; if ($this->_config['proxy-username'] && $this->_config['proxy-password']) { - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->_config['proxy-username'] . ":" . $this->_config['proxy-password']); + $options[CURLOPT_PROXYUSERPWD] = $this->_config['proxy-username'] . ":" . $this->_config['proxy-password']; } } + + curl_setopt_array($ch, $options); + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + } + $data = curl_exec($ch); curl_close($ch); if ($isJson) { @@ -614,8 +616,6 @@ private function remote_call($url = "", $isJson = true, $headers = ['Referer: ht */ private function failure() { - - @unlink($this->_config['cookie_file']); return false; } /**