[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.
This commit is contained in:
triatic 2019-09-12 15:14:48 +01:00 committed by Lyra
parent 7aba7992aa
commit 50c971d545

View file

@ -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':