Problem with MineCraft Server Info Using MineQuery

Ask about a PHP problem here.
Post Reply
Snakybo
Posts: 9
Joined: Thu Jan 05, 2012 3:35 pm

Problem with MineCraft Server Info Using MineQuery

Post by Snakybo »

Hi, I follwed your tutorial "MineCraft Server Info Using MineQuery" but I get this error:
Warning: include() [function.include]: Failed opening '/home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/config.inc.php}' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/init.inc.php on line 5

Parse error: syntax error, unexpected T_IF in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/inc/mc.inc.php on line 6
This is my code:
<?php

$path = dirname(__FILE__);

include("{$path}/config.inc.php}");
include("{$path}/inc/mc.inc.php");

?>
Anything I did wrong here?
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by bowersbros »

{$path}/config.inc.php}

You have an } on the end of that line

so it is looking for a file name with config.inc.php} in it, which doesnt exist.

Change to {$path}/config.inc.php
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Snakybo
Posts: 9
Joined: Thu Jan 05, 2012 3:35 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by Snakybo »

Thanks, that fixed that but now I get:
Parse error: syntax error, unexpected T_VARIABLE in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/config.inc.php on line 4
<?php

$path = dirname(__FILE__);

include("{$path}/config.inc.php");
include("{$path}/inc/mc.inc.php");

?>
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by bowersbros »

can you post the code for the two included pages ?

Especially the config page since the error is relating to that one.

If you read the error, it tells you what it is.

Unexpected Variable declared n config.inc.php near to line 4.

Eg, look at line 3. Most likely there is a semi colon missing.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Snakybo
Posts: 9
Joined: Thu Jan 05, 2012 3:35 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by Snakybo »

Oh thanks, managed to fix some forgotten ";"'s
Anyways, I also did like he said to hide this error message if it can't connect to the server:

Warning: fsockopen() [function.fsockopen]: unable to connect to 86.80.237.30:25566 (Connection timed out) in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/inc/mc.inc.php on line 4
86.80.237.30:1337

Currently Offline! 
Here's the PHP:
<?php

function fetch_server_info($ip, $port){
	$socket = fsockopen($ip, $port, $errno, $errstr, 0.5);

	if ($socket === false){
		return false;
	}
	
	fwrite($socket, "QUERY_JSON\n");
	
	$responce = stream_get_contents($socket);
	
	return json_decode($responce, true);
}

?>
Anything wrong with that?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Problem with MineCraft Server Info Using MineQuery

Post by jacek »

Snakybo wrote:Anything wrong with that?
Looks okay to me, does it work ?
Image
Snakybo
Posts: 9
Joined: Thu Jan 05, 2012 3:35 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by Snakybo »

Not sure yet, need to fix my WiFi to turn the server on
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by bowersbros »

Is the port number definately right?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Snakybo
Posts: 9
Joined: Thu Jan 05, 2012 3:35 pm

Re: Problem with MineCraft Server Info Using MineQuery

Post by Snakybo »

bowersbros wrote:Is the port number definately right?
Should be, I didnt change the default MineQuery port
Post Reply