My favorites
▼
|
Sign in
php-plurk-api
A Plurk API Implementation with PHP.
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
10
attachment: diff.txt
(1.7 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Index: plurk_api.php
===================================================================
--- plurk_api.php (revision 97)
+++ plurk_api.php (working copy)
@@ -161,7 +161,17 @@
*/
protected $privacy;
+ /**
+ * String contains proxy host and port for CURL connection
+ * @var string $proxy
+ */
+ protected $proxy = '';
+ /**
+ * String contains proxy authentication for CURL connection
+ * @var string $proxy_auth
+ */
+ protected $proxy_auth = '';
function __construct() {}
@@ -189,6 +199,12 @@
curl_setopt($ch, CURLOPT_COOKIEFILE, PLURK_COOKIE_PATH);
curl_setopt($ch, CURLOPT_COOKIEJAR, PLURK_COOKIE_PATH);
+ if($this->proxy != '')
+ curl_setopt($ch, CURLOPT_PROXY, $this->proxy);
+
+ if($this->proxy_auth != '')
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxy_auth);
+
$response = curl_exec($ch);
$this->http_response = $response;
@@ -200,6 +216,24 @@
}
/**
+ * function set_proxy
+ * Set proxy server options while connecting to Plurk API
+ *
+ * @param string $host Proxy server host
+ * @param string $port Proxy server port
+ * @param string $username Username for proxy server authentication. Could be ignored if no need.
+ * @param string $password Password for proxy server authentication. Could be ignored if no need.
+ */
+ function set_proxy($host = '', $port = 0, $username = '', $password = '')
+ {
+ if($host != '' && $port != 0)
+ $this->proxy = "http://$host:$port";
+
+ if($username != '' && $password != '')
+ $this->proxy_auth = "$username:$password";
+ }
+
+ /**
* function register
* Register a new Plurk account. Should be HTTPS
*
Powered by
Google Project Hosting