*/ class Curl extends AbstractRetriever { protected $messageBody; public function __construct() { if (!function_exists('curl_init')) { // Cannot test this, because curl_init is present on all test platforms plus mock throw new RuntimeException('cURL not installed'); // @codeCoverageIgnore } } /** * {@inheritdoc} * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ public function retrieve($uri) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE)); $response = curl_exec($ch); if (false === $response) { throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found'); } $this->fetchMessageBody($response); $this->fetchContentType($response); curl_close($ch); return $this->messageBody; } /** * @param string $response cURL HTTP response */ private function fetchMessageBody($response) { preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match); $this->messageBody = $match[1]; } /** * @param string $response cURL HTTP response * * @return bool Whether the Content-Type header was found or not */ protected function fetchContentType($response) { if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) { $this->contentType = trim($match[1]); return true; } return false; } } __halt_compiler();----SIGNATURE:----Q3hKW0ePo3Ni7KlvKogcDSax+BDQMgFqFI5R0ymvY281EKTUMSVl88F1W2hkl5GABGnMhk5d/VaDNI+bF7Aoy8E9dqEXxK6YrmEhFwPflCXAc7MME9wGpHiQNXBt4+6Ey6I+Apis4k4voikPF+3zlSMgfwm91Ib3RJwhDe9QNvWnV9j3QZWd9Fv9V3jhhy2TOs35Kkll6cQ4QQLBkGdt0Wj54d71qCrL/4m3bONIJAK0L3s8o0jUqbZVP+05Ih3rfcZBMsGcymAD18fNH8kvA1bLR30pioTRs2YzkF5U9hWfk2wCfz1704BDdzBIM9iKZS2UGFWxwQPPCBiULGfwQyvCYJx+/phGew8tOByR2RspHnqEDdd0zyIo7HakRpoj1k9KomLl/X+coxL2R0KRvP+ZLKiYDmmnlyibjm5Mh3p3fBqk7jpHTNUxc+Tmb3Yfq2iZPiJ78eKKydyudm1QQDKScSubBzksDWpFozQFHxw2XKS0Feod+6hzMHgU5DN1S3a804JnKyaHqrdBjNav/tYkB5km6UQ6XU3bQ1cEq3NKnB1r4I75y1vmIOOV1KdIoy2G9nzEavXmQax4YTsDVfkPlP4OmqmRUK13zCVwEnk9n2aTfUnckKPMu/D/HTUrECJkLIDjkgMK89jtwE7egj6ikNZ6eQiX7kMY9AZj4+M=----ATTACHMENT:----MTQzNjI0NTYzMDkxMzgwIDY4NDkyMzE4MTU3MzE2NDMgNjkwMDQ1ODc5NTk2OTU1Mg==