Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a65189

Browse files
added ability to customize storage directory for cookies, etc...
1 parent cc82155 commit 7a65189

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/BrowserClient.php‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,29 @@ class BrowserClient extends Client
2121
CURLOPT_TIMEOUT => 15
2222
);
2323

24+
protected static $storage_dir;
25+
2426
/** @var string Where the cookies are stored */
2527
protected $cookie_file;
2628

2729
public function __construct()
2830
{
2931
parent::__construct();
3032

31-
$cookie_file = join(DIRECTORY_SEPARATOR, [sys_get_temp_dir(), "BrowserClient"]);
33+
$cookie_file = join(DIRECTORY_SEPARATOR, [static::getStorageDirectory(), "BrowserClient"]);
3234
$this->setCookieFile($cookie_file);
3335
}
3436

37+
protected function getStorageDirectory()
38+
{
39+
return static::$storage_dir ? static::$storage_dir : sys_get_temp_dir();
40+
}
41+
42+
public static function setStorageDirectory($path)
43+
{
44+
static::$storage_dir = $path;
45+
}
46+
3547
/**
3648
* Format ip:port or null to use direct connection
3749
* @param $proxy_server

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /