You are here: Re: fsockopen error need some help thanks « PHP Programming Language « IT news, forums, messages
Re: fsockopen error need some help thanks

Posted by saddor on 11/25/06 13:53

Very simple my friend

Solution One
<?php
$host = "www.example.com";
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>

Option 2 (> PHP 4 and if the server allow) :
$file = file_get_content("http://www.example.com/test.php");

Option 3:
$f = fopen("http://www.example.com/test.php","r");
while ($r = fread($f, 1024)
print $r;

fclose($f);



Is that useful for you?

--
Cesar Rodas
http://www.phpclasses.org/grank (A PHP implementation of PageRank)


On Nov 20, 7:40 pm, Yoko <n...@na.ca> wrote:
> So I am using php version 4.3.9 and lets say i have a file on the server
> called tester.php
>
> so i am using fsockopen to point to that file but it gives me a error below.
>
> $fh = @fsockopen("http://www.mysite.com/teter.php", "80", $errno, $errstr,
> 180);
>
> 111 Connection refused
>
> This server is linux Redhat Enterprise with Apache 2.x
>
> Is there anything i need to edit in the php.ini file or apache file.
>
> Thanks...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация