Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2009-12-15, at 11:55 PM, Richard Quadling wrote:

> Do you have a default stream context defined for the http stream?

Nope.

> 
> A _LONG_ time ago, when I was using a firewall with NTLM
> authentication (which PHP doesn't deal with), I had to route all my
> calls through a local proxy.
> 
> This was the code I had ...
> 
> <?php
> // Define the default, system-wide context.
> $r_default_context = stream_context_get_default(
> 	array(
> 		'http' => array( // All HTTP requests are passed through the local
> NTLM proxy server on port 8080.
> 			'proxy' => 'tcp://127.0.0.1:8080',
> 			'request_fulluri' => True,
> 		),
> 	)
> );
> 
> // Though we said system wide, some extensions need a little coaxing.
> libxml_set_streams_context($r_default_context);
> 
> 
> Now, you may not see this in your code, but may be in a script which
> is loaded via auto_prepend_file.

Wish it were, but my test code is bare bones.

> 
> I would also suggest running something like WireShark at the same time
> as your script. See if there is ANY traffic over the wire.
> 
> Do the cURL and file_get_contents() code generate identical requests?

cURL -- both PHP and command-line -- fetches files and URLs (remote and local) w/o issues. file_get_contents() fetches files, but fails on all URLs (remote and local). This is why I believe the problem lies with the machine's configuration and not the Firewall.

It's pretty confounding, isn't it? I'm not sure what to do at this point.

...Rene



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux