在流明中,我的代码在下面以api响应的形式发送文件内容,对于某些文档来说,它工作正常,但是对于某些文档,它给出了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";
它给我的错误是,无法打开流:PATH中没有这样的文件或目录...