ID: 40197 Updated by: [EMAIL PROTECTED] 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 Assigned To: tony2001 New Comment:
Use a sniffer. tcpdump, for example. Previous Comments: ------------------------------------------------------------------------ [2007-01-23 18:03:39] ddrewery at gmail dot com Yes, it works without the firewall. That is why I agreed with you in my earlier post. However, my question is now about fsocketopen vs fopen.. what is the actual code that drives file_get_contents()? There is obviously something differnt in the headers that my firewall doesn't like.. how do I see what headers php is sending? ------------------------------------------------------------------------ [2007-01-23 17:55:20] [EMAIL PROTECTED] Let's try another route. Please try to run the same code on a machine, which is 100% NOT behind a firewall and see if it works for you. ------------------------------------------------------------------------ [2007-01-23 17:46:47] ddrewery at gmail dot com I just change the fsocket example to $out = "GET / HTTP/1.0\r\n"; It still works fine. What method does the wrapper use? Does it literally open a socket just like fsocketopen would? ------------------------------------------------------------------------ [2007-01-23 17:39:31] [EMAIL PROTECTED] >Does file_get_contents() use anything other than port 80 for http requests?? No, of course it does not. But it uses HTTP/1.0 and I have no idea how exactly your firewall filters the data. ------------------------------------------------------------------------ [2007-01-23 17:22:28] ddrewery at gmail dot com Ok, its being blocked by the firewall.. however I still confused at why. Port 80 is wide open and fsockets work fine. $location = "www.google.com"; $fp = fsockopen($location, 80, $errno, $errstr, 30); $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); print $result; That works fine $location = "http://www.google.com"; $result = file_get_contents($location); That does not work. Does file_get_contents() use anything other than port 80 for http requests?? ------------------------------------------------------------------------ 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