Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 1059b3b

Browse files
committed
RpcConnector now stores cookie into file
1 parent 3d5cef1 commit 1059b3b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
#### Changed
6+
- RpcConnector now stores cookie into file
57

68
## [v3.2.0]
79
#### Added

lib/RpcConnector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929
class RpcConnector
3030
{
31+
const COOKIE_FILE = '/tmp/proxyidp_cookie.txt';
32+
3133
private $rpcUrl;
3234
private $user;
3335
private $password;
@@ -57,6 +59,8 @@ public function get($manager, $method, $params = [])
5759
curl_setopt($ch, CURLOPT_URL, $uri . '?' . $paramsQuery);
5860
curl_setopt($ch, CURLOPT_USERPWD, $this->user . ":" . $this->password);
5961
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
62+
curl_setopt($ch, CURLOPT_COOKIEJAR, self::COOKIE_FILE);
63+
curl_setopt($ch, CURLOPT_COOKIEFILE, self::COOKIE_FILE);
6064

6165
$json = curl_exec($ch);
6266
curl_close($ch);
@@ -94,6 +98,8 @@ public function post($manager, $method, $params = [])
9498
['Content-Type:application/json', 'Content-Length: ' . strlen($paramsJson)]
9599
);
96100
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
101+
curl_setopt($ch, CURLOPT_COOKIEJAR, self::COOKIE_FILE);
102+
curl_setopt($ch, CURLOPT_COOKIEFILE, self::COOKIE_FILE);
97103

98104
$json = curl_exec($ch);
99105
curl_close($ch);

0 commit comments

Comments
 (0)