*/ 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:----yJcteiE+R6u4kHLKcpTizUqT7BgaSYzi5CckPF3b+V4gEBtTXvbzRk8LO33YQ+EjHpyWSsZdQv7TwnhwgYQ0XtEDqHwFoiUOiNWs70NxrKwf2ZdwltfEa0jKwxOI+WWIyrDEcEHLEK80E86S8oIgrfjaFoVvvyd9Nlwrt5yG3elGKlOPJVoS/KMaZQeWpEF7dhceUhAlyqPa8wJXq0IYGvURR7dwXeo40mor3VECPb6YG5wrXi0XH/UiN6Pk22X8GOgM0jgxOOaJRh1c752dOc/lsUbHNmZ1F/EXDc5IY6Qvz+q1Xkn7vtA8Vt8IBV3iBxEGiVLsX98m5GuUqykpa+ZWFXL9xqm5hhb1u08G+Ixowf/l002wPNOfSQW5fl5CaTz7p98r6BpYmQPzvFYTKsbcl5nyqJQ88uyWZ4ub3qayG0scvAVFUsm0vjUBG0DF53E+ICowlvj3FyXAyUrPPt562e2vi/SnYUZ3VOcdNYAM+/jph5ywu6RsYXAZXQSghwhKf8yvENzTiUY56foH0u74t8pi7zlef4MV7xpIF1bT/AT4NimryiNs8RADFD4PSCQ2DhUdPVFfYIRbH47LjyM+GPERA+SK7Bwn4z3OVkpwnET9JV2Lvb216DIou6W6JMF4lJGXNTt1Qv4jpeiisDor6668b2+jj4QfCJi7A/c=----ATTACHMENT:----MTc2NDg3MTgxNTY1MDg1NCAxNDAzMTEwMzU3NDIzNTYgNTQ4Nzc3NzMyMTcxMzY0MA==