[PHP] strip down Warnings

2004-03-10 Thread dmesg
Hi there,
i'm just starting with php.
How can i tell fsockopen() to skip to echo this warnings?

I get all of these warnings and would like to strip them down:


Warning: fsockopen(): unable to connect to 192.168.2.209:5800 in
/var/www/htdocs/3.php on line 13
o port 5800 em 192.168.2.210 está aberto

Warning: fsockopen(): unable to connect to 192.168.2.211:5800 in
/var/www/htdocs/3.php on line 13


heres my script:

--
html
body
?php
 $rede=192.168.2.;
 $portNumber=5800;
 for ($i=209;$i212;$i++){
  $targetIP= $rede . $i;
  $a[$i]=_scanport ($targetIP, $portNumber);
  //echo $a[$i];
  }
 function _scanPort ($targetIP, $portNumber) {

  $handle = fsockopen($targetIP, $portNumber,
$errno, $errstr, 2);
  if ($handle) {
   fclose($handle);
   echo o port  . $portNumber . 
em a href=\http://;. $targetIP .:. $portNumber . \. $targetIP .
/a.  está abertobr/;
   }
  return 0;
  }
?
/html

-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] strip down Warnings

2004-03-10 Thread Miguel J. Jimnez
Use '@' before any function to avoid echoing warnings (JUST warnings)

--
Miguel J. Jiménez
ISOTROL, S.A. (Área de Internet)
Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
[EMAIL PROTECTED]
TLFNO. 955036800 ext. 111
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strip down Warnings

2004-03-10 Thread trlists
On 10 Mar 2004 dmesg wrote:

 How can i tell fsockopen() to skip to echo this warnings?

Here's a repeat of something I just posted the other day on this ...

Here's an approach I have used to avoid any error messages at all --
presumably you could also set a flag in the error handler to indicate
what happened, if you need that.  You need to both disable error 
reporting and set a do-nothing error handler.

 .

$olderr = error_reporting(0);
set_error_handler(ignoreerrhandler);
$fp = fsockopen(.)
restore_error_handler();
error_reporting($olderr);
if ($fp) {
[worked]
} else {
[failed]
}
 .
function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
return;
}

--
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php