|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-22 21:39 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
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