*/ 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:----nOiUQA/muaAuQAEQZKJxSSPwREDBYiC+en5sjQD/Adu8+xk4BarftKANqclVVXr/F/g5Npokeg5uABDvLf1foZvAQJ8EbikJlhqDEAW8axp6nCqVRx4KzUNu7B0OjUMhnYurGCZG0ScE8h9FrQMuhkLqZLOUXYbX7/RdwhohU1+Y+M5nbP2UKMQjFyU/FJFeWAekKkfF9d6GzLCTUmu1q/1eW0lGwZRAwH4XF91u7cmvsZDWlCl2dgQQ/fW/5j0BtWlsMI/O39E702elhJpNj4oYE56sH0ERthLF+ITzulKWH7lRNKpL0F+nWDUNFomc6ptT2Jw9C05yBOli14dercr1igEWvFhVATNj1GKO/jmFGsl/3Gfn7+WEsnHWs5yXXM0dwOvBOW7CfmGalQpHdp5p99RREINaqmLFtKDhKUDGSQk9MdOhMsNTQFnZ4bGYtsW9FfLGenGlmihVdwaZwsA19zoqLxSzC4u/gIV8jHStpKwnaH6Z5Yyfp5y7ZBfHRItiC/R5RtNuWjME2+ANAuOw+NtZfv6Z73UljoZTCW2K6RH00tPmXfV4GH0mCWx0j713a8qhphTKAYpwwgLYqdFTFdbBf61Aedeth7lAUk/WFezXMAIXB9iMD9oZ2c/VVlozRO43phK7z2rsjWk0ehBy8EshtvGeNtRhZCjuqpc=----ATTACHMENT:----NjgzMzk0NTk4MTUwODU3MCA3MzQ5MjgxMDM2NTMxMTE0IDY2Njg5NTM3NTE4OTM4NDE=