Matt Williams
Matt Williams

Reputation: 79

fsockopen is returning an error even if the server im trying to reach is online?

im using fsockopen below:

$socket = fsockopen("uberminecraft.com", 25565, $errno, $errstr, 1);

return ($errno === 0);

Now this should return either false or true if the server is up or not. I know this server is definty up yet i still keep getting an error

Warning: fsockopen() [function.fsockopen]: unable to connect to uberminecraft.com:25565 (Connection timed out)

Upvotes: 0

Views: 553

Answers (2)

Kushal
Kushal

Reputation: 2791

You must change fsockopen function as follow

$socket = fsockopen("uberminecraft.com", 25565, $errno, $errstr, 30);

Still you are getting same error. please tell to your host provider to open 25565 port.

Thanks

Upvotes: 0

Thorbear
Thorbear

Reputation: 2333

You have set a timeout of 1 second, is this intentional? Do you know whether the server is able to provide a response fast enough? Have you tried setting a higher timeout?

Also you might want to look at php.net for how to check whether the connection was made.

Upvotes: 1

Related Questions