脚本宝典收集整理的这篇文章主要介绍了php file_get_contents向Bugzilla安装发送错误的内容类型,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用GOOGLE Code http://code.google.com/p/bugzillaphp/上提供的BugzillaPHP
一切都在我的本地服务器上正常工作,但不在运行脚本的远程服务器上运行.
我从Bugzilla回来的错误是:
这意味着我的脚本在标头中发送了错误的内容类型(或者Bugzilla错误地检测到标头).
但是我很确定content-tyPE设置为正确的值.
这是我的代码:
$context = stream_context_create(array('http' => array( 'method' => 'POST','header' => 'Content-Type: text/htML','content' => $body ))); $response = file_get_contents($url,false,$context);
有任何想法吗?
$params = array('http' => array( 'method' => 'POST','content' => $body )); // workaround for PHP bug where http headers don't get sent in PHP 5.2 if(version_compare(PHP_VERSION,'5.3.0') == -1){ ini_set('user_agent','PHP-SOAP/' . PHP_VERSION . "\r\n" . $params['http']['header']); } $context = stream_context_create($params); $response = file_get_contents($url,$context);
以上是脚本宝典为你收集整理的php file_get_contents向Bugzilla安装发送错误的内容类型全部内容,希望文章能够帮你解决php file_get_contents向Bugzilla安装发送错误的内容类型所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。