Re: fsockopen() prob
| From: | Fred | Date: | Wed, 28 Nov 2001 19:04:04 +0000 |
| Subject: | Re: fsockopen() prob | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75921@lists.php.net to get a copy of this message | ||
Global variables are not really global in php because they are not available
from within functions unless you specifically declare them as global. This
should work:
130 function get_line {
131 global $socket_open;
132 $buffer = fgets($socket_open,500);
133 $buffer = eregi_replace("(\r|\n)","",$buffer);
134 return $buffer;
135 }
Fred
Yura <bodybuilders@comic.com> wrote in message
news:3C054EE3.19234.2726172@localhost...
> I have a global variable
> $socket_open = fsockopen($pop_server, 110, $errno, $errstr, 60 );
> then I define the function:
>
> 130 function get_line {
> 131 $buffer = fgets($socket_open,500);
> 132 $buffer = eregi_replace("(\r|\n)","",$buffer);
> 133 return $buffer;
> 134 }
>
> Here I've got the prob - it doesn't work, it sais: Warning: Supplied
argument is not a valid File-
> Handle resource in .../inc/pop-functions.inc on line 131
>
> At the same time $socket_open returns "Resource id #2" I don't know what
it means, could
> anyone help me with it?
>
> Youri
>
>
>
>
> <>< <>< <>< <>< God is our provider ><>
> ><> ><> ><>
> http://www.body-builders.org
>
>