*/ 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:----J1cBevpBoDHiEadtUuR7yW2roA+MC18zJbN3OoHQCrwNvR4Yfak77IRC7bWbD9tEF2wWyBpFqhD2wT7wxQctDCfOiENffG53y6Gm5dzUBlJe9d1OWgE/8P9B6OzjFaSsUHRm9CfY+SHyvj7ejKCnEUFDY+x1zZG3U7R5HXLpoScCn1xrVaelKqpirNYunvwKaTnW8Q+mxNOcK5Bo8993gRtmxei7GsDY1I2jSdu+FmD4K34olJ0RSuXDyknMeRFLtu3lmzctFv4XVJCLXhGO2HYaOObZezgPJR3lzg4ZdLkMdtjTOVV8YFJkgyeEbkGd3K/e7AMaz4/WNI8DZzH/Gj/LTw3ULVw5b13UK1LrprcaJd6yUlsbTRTB+67163eA7rE/RKAcMxhGL/LN0pvGJ0zLIiKJ97aKLy18xNPMwxkj/VEPVxkT7DPu7qujE4faTsEsXTXWPfiG9r+kqocDvndu4BgN7frV2nCvPBoZNCzXjukYLCOiUK7t6pWkyP6NayhS27FNqdwgabU8uwQjnQLNGRCRu60KB9Zs49T/V/T7iXo0w3lAhXaTHcfWsGfyIS9XuBpCCgfYB1UlLAjGLYk+HZqsivp/xV+oKo6L4fdOBBWT4tjWqQtW3gc/yEveDvd0eIboWxzwiI2MwTOJ0Oysegk/A7rHTtoAIe00XKE=----ATTACHMENT:----MzA0NzY4OTMwMTAyMzIwMiA4MjQxMDk4NDYxNDIwMTgzIDIwNzIwMTE5ODYyOTg0MTY=