Page 1 of 1

Warning: Missing argument 2 for server_online()

Posted: Wed Jan 16, 2013 7:38 pm
by SnipeLike
hi

i got allways the same warning on my php page: :?:

Warning: Missing argument 2 for server_online(), called in C:\xampp\htdocs\index.php on line 137 and defined in C:\xampp\htdocs\minecraftserver.inc.php on line 3

Warning: fsockopen(): unable to connect to 25565:0 (Failed to parse address "25565") in C:\xampp\htdocs\minecraft_server.inc.php on line 4

this is my minecraftserver.inc.php:
<?php
function server_online($server, $port){
	fsockopen($server, $port, $errno, $errstr);
	
	return ($errno === 0);
}	
?>
heres my index.php:

<?php	
var_dump(server_online($servers[0][1]));
?>
and my init.inc.php:
<?php
$servers = array(
	array('server.no-ip.org', '25565'),
);

$path = dirname(__FILE__);

include("{$path}\minecraftserver.inc.php");

?>
can you halp me pls?

thank you,
Sl

Re: Warning: Missing argument 2 for server_online()

Posted: Wed Jan 16, 2013 7:42 pm
by ExtremeGaming
The error message says it all. You are defining the function here:
<?php
function server_online($server, $port){
	fsockopen($server, $port, $errno, $errstr);
	
	return ($errno === 0);
}	
?>
Note that you have two arguments when defining it. $server, and $port. Now, when you are using it here:
<?php	
var_dump(server_online($servers[0][1]));
?>
Note that you are only using one argument. Also note that you aren't defining $servers, $errno, or $errstr anywhere visible.

Re: Warning: Missing argument 2 for server_online()

Posted: Wed Jan 16, 2013 7:55 pm
by SnipeLike
ExtremeGaming wrote:The error message says it all. You are defining the function here:
<?php
function server_online($server, $port){
	fsockopen($server, $port, $errno, $errstr);
	
	return ($errno === 0);
}	
?>
Note that you have two arguments when defining it. $server, and $port. Now, when you are using it here:
<?php	
var_dump(server_online($servers[0][1]));
?>
Note that you are only using one argument. Also note that you aren't defining $servers, $errno, or $errstr anywhere visible.
thx for your fast answer! :D
and thx for your help ;)

so it works now...
~this post can be closed~

Re: Warning: Missing argument 2 for server_online()

Posted: Wed Jan 16, 2013 9:45 pm
by Helx
Threads don't necessarily need to be closed when the question is answered.