Mahngiel Posted March 25, 2013 Share Posted March 25, 2013 Issue: Retrieving data from remote HTTP locations. "failed to open stream: HTTP request failed!" Doesn't Work: fopen(), file_get_contents(), SoapClient('[url=]http://remote_wsdl[/url]') Works: curl, wget via CLI & exec() Tried: Set all ini's to allow_url_fopen = 'On' root@OW-WS01:~$ php -v PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar 4 2013 14:05:25) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH root@OW-WS01:~# php -i --php-ini /etc/php5/apache2/php.ini | grep 'fopen' allow_url_fopen => On => On root@OW-WS01:~# grep 'fopen' -R /etc/php5/ /etc/php5/cli/php.ini:; http://php.net/allow-url-fopen /etc/php5/cli/php.ini:allow_url_fopen = On /etc/php5/apache2/php.ini:; http://php.net/allow-url-fopen /etc/php5/apache2/php.ini:allow_url_fopen = On Code Debug: ini_set('default_socket_timeout', 10); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); echo 'allow_url_fopen:' . (ini_get('allow_url_fopen') ? 'TRUE' : 'FALSE') . '<br/>'; echo 'default_socket_timeout: ' . ini_get('default_socket_timeout') . '<br/>'; $Remote_XML = "valid_path.xml"; $todays_XML = __DIR__ .'/imports/' . date( 'Ymd', time() ) . '.xml'; echo '<hr/><br/> Testing fopen()<br/>'; $from = fopen( $Remote_XML, 'r' ); $to = fopen( $todays_XML, 'w+' ); stream_copy_to_stream( $from, $to ); echo '<hr/><br/> Testing file_get_contents()<br/>'; $fgc = file_get_contents($Remote_XML); file_put_contents($todays_XML, $fgc ); echo '<hr/><br/> Testing SoapClient()<br/>'; try{ $soap = new SoapClient( '/?wsdl', array( 'trace' => TRUE ) ); $soap->login( 'user', 'pass' ); echo 'soap passed'; } catch( SoapFault $e ) { var_dump($e); } phpinfo(INFO_CONFIGURATION); Results in image format: http://i.imm.io/10Hle.png So, how do I overcome this? Have sniffed packets and these requests aren't even getting generated. This code works just dandy on local and on another server, so there's got to be something I haven't figured out yet. Any idea what could be causing this or what to try next? Thanks Link to comment https://forums.phpfreaks.com/topic/276143-external-data-requests-failing/ Share on other sites More sharing options...
Mahngiel Posted March 26, 2013 Author Share Posted March 26, 2013 Well, though these issue remain, I have developed a workaround by using cURL() for the downloads and using a hard-copy of the WSDL with these options in the SoapClient constructor $this->Client = new SoapClient( "path/to/local.wsdl", array( 'soap_version' => 1.1, 'trace' => TRUE, 'stream_context' => 'context' ) ); Further, had to remove a schema import from the xml. Am still looking for an answer as to why these changes need to be made. Link to comment https://forums.phpfreaks.com/topic/276143-external-data-requests-failing/#findComment-1421178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.