From 50c971d5453983123c0a120a90c0afafaecf7092 Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Thu, 12 Sep 2019 15:14:48 +0100 Subject: [PATCH] [TwitterBridge] Enable cookies with curl (#1245) * [TwitterBridge] Enable cookies with curl Enable cookies in curl, or fall back to `file_get_contents` if in CLI mode with no curl root certificates. --- bridges/TwitterBridge.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index e8b9d944..2f5565b1 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -171,9 +171,14 @@ EOD public function collectData(){ $html = ''; $page = $this->getURI(); - $cookies = $this->getCookies($page); - $html = getSimpleHTMLDOM($page, array("Cookie: $cookies")); + if(php_sapi_name() === 'cli' && empty(ini_get('curl.cainfo'))) { + $cookies = $this->getCookies($page); + $html = getSimpleHTMLDOM($page, array("Cookie: $cookies")); + } else { + $html = getSimpleHTMLDOM($page, array(), array(CURLOPT_COOKIEFILE => '')); + } + if(!$html) { switch($this->queriedContext) { case 'By keyword or hashtag':