|
@@ 87-89 (lines=3) @@
|
| 84 |
|
); |
| 85 |
|
$request->getEmitter()->on('progress', $onProgress); |
| 86 |
|
$response = $this->httpClient->send($request); |
| 87 |
|
if ($response->getStatusCode() !== 200){ |
| 88 |
|
throw new \UnexpectedValueException('Failed to download ' . $url . '. Server responded with ' . $response->getStatusCode() . ' instead of 200.'); |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
} |
| 92 |
|
|
|
@@ 167-169 (lines=3) @@
|
| 164 |
|
*/ |
| 165 |
|
protected function download($url){ |
| 166 |
|
$response = $this->httpClient->get($url, ['timeout' => 600]); |
| 167 |
|
if ($response->getStatusCode() !== 200){ |
| 168 |
|
throw new \UnexpectedValueException('Failed to download ' . $url . '. Server responded with ' . $response->getStatusCode() . ' instead of 200.'); |
| 169 |
|
} |
| 170 |
|
return $response->getBody()->getContents(); |
| 171 |
|
} |
| 172 |
|
|