In lumen my code is below to send file content in api response , for some document it is working fine but for some document it gives error for HTTP\_INTERNAL\_SERVER\_ERROR

```
$content = base64_encode(file_get_contents($URL));

```

```
Symfony\Component\HttpKernel\Exception\HttpException Object
(
    [statusCode:Symfony\Component\HttpKernel\Exception\HttpException:private] => 500
    [headers:Symfony\Component\HttpKernel\Exception\HttpException:private] => Array
        (
        )
```

```
[message:protected] => HTTP_INTERNAL_SERVER_ERROR
[string:Exception:private] => 
[code:protected] => 0
[file:protected] => D:\xampp7.1\htdocs\PROJECT_NAME\app\Exceptions\Handler.php
[line:protected] => 76
[trace:Exception:private] => Array
    ( ...

```

Is there any solution or required to set php.ini veriable ??

In web error log it gives me error like , 

```
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported

```

to resolve this I have get file content with help of below,

```
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $data[$k]['doc_url']);
$data = curl_exec($ch);
curl_close($ch);
echo"<pre>";print_r($data);die;

```

it gives me empty output without file contect

I have also add below code 

 `$content = base64_encode(file_get_contents(urlencode($data[$k]['doc_url'])));
 $data[$k]['doc_content'] = "$content";`
It gives me error of , failed to open stream: No such file or directory in PATH...