PHP文件\u获取\u内容500 PHP中的内部服务器错误

PHP文件\u获取\u内容500 PHP中的内部服务器错误,php,Php,我的代码如下:- $context = stream_context_create(array('http' => array( 'method' => "POST", 'header' => "Content-Type:text/xml\r\nUser-Agent:PHPRPC/1.1\r\n", 'content' => $request )));

我的代码如下:-

$context   = stream_context_create(array('http' => array(    
            'method' => "POST",           
        'header' => "Content-Type:text/xml\r\nUser-Agent:PHPRPC/1.1\r\n",        
        'content' => $request )));         
$file      = file_get_contents($this->server, false, $context);    

Warning: 
file_get_contents(http://abc.co.in/employers/index.php/JobPostingServices/getResponse):    
failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/project/client.php on line 40 

问题出在用户代理标题中。这对我很有用:

$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$header = file_get_contents('https://www.example.com',false,$context);

您正在联系的服务器在联系时会出现500个内部服务器错误,就像您的错误所说的那样。你对此无能为力-问题出在他们的服务器上。那么,我要做的是,请详细告诉我,你是否尝试过使用curl?是的,我使用了curl,但响应相同。那么,最好给他们发电子邮件,让他们知道