php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39594 fsockopen
Submitted: 2006-11-22 19:00 UTC Modified: 2006-11-22 21:39 UTC
From: realtime158 at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.4 OS: Linux 2.6.9-42.0.3
Private report: No CVE-ID: None
 [2006-11-22 19:00 UTC] realtime158 at hotmail dot com
Description:
------------
fsockopen will not work to any local page located within that domain.  And will not render the page.  If i copy the url into the browser it works no problems.  Also it will work on any other domain other then ours. The admin from the hosting company that we purchased a box off told us this. 

Since your server is behind a firewall, you will not be able to include files from other sites on your server by using the domain name. The domain names all resolve to the external IP address, but that IP address cannot be accessed from behind your firewall.


Reproduce code:
---------------
<?php
$fp = fsockopen ("http://www.fetchads.com/login/index.php", 80, $errno, $errstr, 30);
if(!$fp) {
   echo $errstr;
} else {
   fwrite($fp, "GET / HTTP/1.1\r\nHost: www.fetchads.com\r\nConnection: Keep-Alive\r\n\r\n");
   $data = '';
   while(!feof($fp)) {
       $data .= fread($fp, 4096);
	    $content .= $data;
       if(substr($data, -9)=="\r\n\r\n0\r\n\r\n") {
           exit;
       }
   }
}
$content = preg_replace('/^(.+?)(\r\n|\n|\015\012){2}/s','',$content);
echo $content;
?> 


Expected result:
----------------
I would like the php code to produce the same screen or close to it as if I were to type it in the browser like this

http://www.fetchads.com/login/index.php

Also i am open to any alternatives except installing php5.  Or any new snapshots


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-22 21:39 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 22:01:31 2024 UTC