从本地LAMP访问SoapClient和file_get_contents

时间:2012-06-28 13:04:13

标签: php apache ubuntu soap virtualhost

我在ubuntu 12.04下工作。 我有一个经典的localhost设置。 apache + mysql + php

file_get_contents在外部网址上失败,但适用于本地文件或“localhost”

file_get_contents('http://google.com');
PHP Warning:  file_get_contents(http://google.com): failed to open stream: HTTP request failed!

soapClient在外部网址上失败,但适用于本地文件或“localhost”

$wsdl = "http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl";
$client = new SoapClient($wsdl,
array(
        'trace'                 => true,
        'exceptions'            => true,
        'soap_version'          => SOAP_1_1,
        'connection_timeout'    => 600,
        'compression' => SOAP_COMPRESSION_ACCEPT ,
        'encoding'=> 'UTF-8', //ISO-8859-1',
        //'cache_wsdl' => WSDL_CACHE_BOTH,
        //'host'     => "localhost",
        //'proxy_host'     => "localhost",
        //'proxy_port'     => 8080,
    ));

SOAP-ERROR: Parsing WSDL: Couldn't load from 
'http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl' : failed to load external entity "http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl"

在phpinfo()中启用allow_url_fopen和allow_include_url(在/etc/php5/apache2/php.ini中设置) 防火墙已禁用 apparmor已禁用

安装了suhosin补丁,我在php.ini

中将suhosin.simulation设置为true

代码在我的生产和登台服务器上运行良好

我没有想法,也没有找到可以检查问题的有趣的日志或命令:'(

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

好的!我找到了一种让它发挥作用的方法。

安装de suhosin-php包以便能够使用Module suhosin。 在/etc/php5/con.d/suhosin.conf中将suhosin.simulation指令设置为on sudo service apache2 restart

肥皂调用仍然非常缓慢,但现在正在使用

感谢您的帮助!