Skip to content

Commit ee1938a

Browse files
author
Alex Sh
committed
.
1 parent 4dd0a83 commit ee1938a

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/ProxyRequestGet.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ class ProxyRequestGet implements ProxyRequestInterface
6969
*/
7070
private $portProxy;
7171

72+
/**
73+
* json|csv|''
74+
* @var string
75+
*/
76+
private $format;
77+
7278
/**
7379
* @param string $token
7480
* @param string $server
@@ -90,7 +96,8 @@ public function sendRequest()
9096
'not_country_code_raw' => $this->notCountryCodeRaw,
9197
'http' => $this->http,
9298
'socks' => $this->socks,
93-
'port_proxy' => $this->portProxy
99+
'port_proxy' => $this->portProxy,
100+
'format' => $this->format
94101
]);
95102

96103
$urlFinal = "{$this->server}/api/proxyget/{$this->token}?{$query}";
@@ -138,7 +145,6 @@ public function setNotCountryCodeRaw($notCountryCodeRaw)
138145
}
139146

140147
/**
141-
*
142148
*
143149
* @param mixed $http 1 or 0
144150
* @return ProxyRequestGet
@@ -177,5 +183,15 @@ public function setPortProxy($portProxy)
177183
return $this;
178184
}
179185

186+
/**
187+
* @param string $format
188+
* @return $this
189+
*/
190+
public function setFormat($format)
191+
{
192+
$this->format = $format;
193+
return $this;
194+
}
195+
180196

181197
}

tests/TestCulrProxyGet.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/bash
22

3-
curl http://public.proxyrequest.ru/api/proxyget/free
3+
# Default, additional field 'success' in response indicates result of operation
4+
curl http://public.proxyrequest.ru/api/proxyget/free
5+
6+
# proxies only, json
7+
curl http://public.proxyrequest.ru/api/proxyget/free?format=json
8+
9+
# proxies only, in csv
10+
curl http://public.proxyrequest.ru/api/proxyget/free?format=csv
11+

0 commit comments

Comments
 (0)