Repository navigation
Expand file tree
/
Copy pathproxy-usage.php
More file actions
62 lines (48 loc) · 2.12 KB
/
Copy pathproxy-usage.php
File metadata and controls
62 lines (48 loc) · 2.12 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
61
62
<?php
namespace ccxt;
include_once (__DIR__.'/../../ccxt.php');
// ----------------------------------------------------------------------------
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
// -----------------------------------------------------------------------------
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('UTC');
use ccxt\Precise;
use React\Async;
use React\Promise;
// AUTO-TRANSPILE //
// ABOUT CCXT PROXIES, READ MORE AT: https://docs.ccxt.com/#/README?id=proxy
function example_proxy_url() {
return Async\async(function () {
$my_ex = new \ccxt\async\kucoin();
$my_ex->proxy_url = 'http://188.34.194.190:8090/proxy_url.php?caller=https://ccxt.com&url=';
var_dump(Async\await($my_ex->fetch('https://api.ipify.org/')));
}) ();
}
function example_http_proxy() {
return Async\async(function () {
$my_ex = new \ccxt\async\kucoin();
$my_ex->http_proxy = 'http://188.34.194.190:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol)
var_dump(Async\await($my_ex->fetch('https://api.ipify.org/')));
}) ();
}
function example_socks_proxy() {
return Async\async(function () {
$my_ex = new \ccxt\async\kucoin();
$my_ex->socks_proxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h
var_dump(Async\await($my_ex->fetch('https://api.ipify.org/')));
}) ();
}
function example_web_sockets() {
return Async\async(function () {
$my_ex = new \ccxt\pro\kucoin();
$my_ex->http_proxy = 'http://188.34.194.190:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests
$my_ex->ws_proxy = 'http://188.34.194.190:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol)
Async\await($my_ex->load_markets());
while (true) {
$ticker = Async\await($my_ex->watch_ticker('BTC/USDT'));
var_dump($ticker);
}
}) ();
}
Async\await(example_proxy_url());