From 906bb8e2fa468ac6eff05be92b9a1a9f6f86ccdb Mon Sep 17 00:00:00 2001 From: Edwin Knip Date: Mon, 12 Sep 2022 10:46:02 +0200 Subject: [PATCH 1/3] Adds proxy through params --- lib/TikTok/Api.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php index 6cfdc24..b867d72 100644 --- a/lib/TikTok/Api.php +++ b/lib/TikTok/Api.php @@ -588,16 +588,19 @@ 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']; + $options[CURLOPT_PROXY] = $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) { From 16970e34fd03efcbd25b32793890c6b255b7427e Mon Sep 17 00:00:00 2001 From: Edwin Knip Date: Mon, 12 Sep 2022 14:24:50 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20proxy=20host/port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/TikTok/Api.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php index b867d72..4021540 100644 --- a/lib/TikTok/Api.php +++ b/lib/TikTok/Api.php @@ -589,8 +589,7 @@ private function remote_call($url = "", $isJson = true, $headers = ['Referer: ht ]; if ($this->_config['proxy-host'] && $this->_config['proxy-port']) { - $options[CURLOPT_PROXY] = $this->_config['proxy-host']; - $options[CURLOPT_PROXY] = $this->_config['proxy-port']; + $options[CURLOPT_PROXY] = $this->_config['proxy-host'] . ':' . $this->_config['proxy-port']; if ($this->_config['proxy-username'] && $this->_config['proxy-password']) { $options[CURLOPT_PROXYUSERPWD] = $this->_config['proxy-username'] . ":" . $this->_config['proxy-password']; } From 1c500e6a11f34f7ebd637133559a8b0e02c726a8 Mon Sep 17 00:00:00 2001 From: Edwin Knip Date: Wed, 5 Oct 2022 10:12:31 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Don=E2=80=99t=20unlink=20coo?= =?UTF-8?q?kie=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/TikTok/Api.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php index 4021540..432d16c 100644 --- a/lib/TikTok/Api.php +++ b/lib/TikTok/Api.php @@ -616,8 +616,6 @@ private function remote_call($url = "", $isJson = true, $headers = ['Referer: ht */ private function failure() { - - @unlink($this->_config['cookie_file']); return false; } /**