1 | <?php |
||
15 | class CommonProxy implements GoogleProxyInterface |
||
16 | { |
||
17 | /** @var string $endpoint */ |
||
18 | protected $endpoint; |
||
19 | |||
20 | /** |
||
21 | * Constructor that initializes the specific proxy service |
||
22 | * |
||
23 | * @param string $endpoint Specific service URL |
||
24 | * @throws InvalidUrlException |
||
25 | */ |
||
26 | 3 | public function __construct(string $endpoint) |
|
34 | |||
35 | /** {@inheritdoc} */ |
||
36 | public function getHttpResponse(string $url): ResponseInterface |
||
37 | { |
||
38 | $data = ['u' => $url, 'allowCookies' => 'on']; |
||
39 | $httpClient = new Client(['cookies' => true, 'verify' => false]); |
||
40 | $response = $httpClient->request('POST', $this->endpoint, ['form_params' => $data]); |
||
41 | |||
42 | return $response; |
||
43 | } |
||
44 | |||
45 | /** {@inheritdoc} */ |
||
46 | 2 | public function parseUrl(string $url): string |
|
62 | } |
||
63 |