#40197 [Opn->Fbk]: Cannot access remote files

From: Date: Mon, 22 Jan 2007 20:12:16 +0000
Subject: #40197 [Opn->Fbk]: Cannot access remote files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107904@lists.php.net to get a copy of this message
 ID:               40197
 Updated by:       tony2001@php.net
 Reported By:      ddrewery at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         HTTP related
 Operating System: Fedora Core 6
 PHP Version:      5.2.0
 New Comment:

How to reproduce it?
# php -r 'var_dump(strlen(file_get_contents("http://google.com")));'
int(3171)


Previous Comments:
------------------------------------------------------------------------

[2007-01-22 19:09:20] ddrewery at gmail dot com

Ok.. I'm now running 5.2.1RC4-dev and still have the same problem.

------------------------------------------------------------------------

[2007-01-22 18:05:55] tony2001@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip



------------------------------------------------------------------------

[2007-01-22 17:51:17] ddrewery at gmail dot com

Already checked that.  If it were a firewall issue, I wouldn't be able
to do this with fsocketopen().

This works fine: http://teton1w.tetonsolutions.com/geo/yh/test3.php
<?php
function loadXFile($location) {
	$fp = fsockopen($location, 80, $errno, $errstr, 30);
	if (!$fp) {
	   $result = "$errstr ($errno)<br />\n";
	} else {
	   $out = "GET / HTTP/1.1\r\n";
	   $out .= "Host: ".$location."\r\n";
	   $out .= "Connection: Close\r\n\r\n";
	
	   fwrite($fp, $out);
	   while (!feof($fp)) {
		   $result .= fgets($fp, 128);
	   }
	   fclose($fp);
	}
	return $result;
}

print loadXFile("www.google.com")
?>

------------------------------------------------------------------------

[2007-01-22 17:23:26] tony2001@php.net

Please make sure you don't have any firewalls blocking your
connections.

------------------------------------------------------------------------

[2007-01-22 17:18:38] ddrewery at gmail dot com

http://teton1w.tetonsolutions.com/geo/yh/test2.php
runs the posted
code.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/40197

-- 
Edit this bug report at http://bugs.php.net/?id=40197&edit=1


Thread (27 messages)

« previous php.bugs (#107904) next »