From:             
Operating system: Linux x86_64 CentOS release 5.5 
PHP version:      5.2.14
Package:          Apache2 related
Bug Type:         Bug
Bug description:file_get_contents does not follow 301 and 302 redirects

Description:
------------
Function file_get_contents() does not follow 301 and 302 redirects sub
apache module.



It returns following:

--8< -----------------------

<HTML><HEAD><meta http-equiv="content-type"
content="text/html;charset=utf-8">

<TITLE>301 Moved</TITLE></HEAD><BODY>

<H1>301 Moved</H1>

The document has moved

<A HREF="http://www.google.com/";>here</A>.

</BODY></HTML>

--8< -----------------------



We got this situation on a 20 servers and even on php-5.2.13, but in the
same time it works on others servers with same configuration. 



Mystery starts when we run this script from command line. It works fine
with cli, wich is compiled with same options and use same php.ini.



Test script:
---------------
<?php

echo file_get_contents("http://google.com";);



Expected result:
----------------
file_get_contents should follow redirects.

Actual result:
--------------
Now it doesn't in some cases.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53018&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53018&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53018&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53018&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53018&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53018&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53018&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53018&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53018&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53018&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53018&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53018&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53018&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53018&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53018&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53018&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53018&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53018&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53018&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53018&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53018&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53018&r=mysqlcfg

Reply via email to