fsockopen udp conn works on localhost but not on my bluehost

Hi, I have made a small script to obtain data from a call of duty game server and display it on a browser. Everything is working fine in my localhost server (Wamp Server 2.2).
When I move the script to my host in bluehost.com it doesn’t return any error but doesn’t return an output either. I can’t find out why. I am not sure if the problem is in the code, please take a look at it.

[php]<?php

$connect = fsockopen( “udp://” . “85.236.102.73”, “28960”, $errno, $errstr, 30 );
if( ! $connect ) exit( ‘fsockopen did not connect’ );

socket_set_timeout( $connect, 1, 0 );

$send = “\xFF\xFF\xFF\xFFgetstatus\x00”;

fwrite( $connect, $send );
fputs( $connect, $send );

$output = fread( $connect, 5000 );

if( ! empty( $output ) ) {
do {
$status_pre = socket_get_status( $connect );
$output = $output . fread( $connect, 5000 );
$status_post = socket_get_status( $connect );
}
while( $status_pre[‘unread_bytes’] != $status_post[‘unread_bytes’] );
}
fclose( $connect );

echo $output;

?>[/php]

$errno returns 0 and $errstr returns nothing. I ran a fsockopen test i found on google, it was supposed to show bbc.com website title and it did so fsockopen is working. It wasn’t an udp connection though so I am not sure if it is the problem. Could it be the host’s problem? What can I do?

$output is supposed to return something like this: ����statusResponse _Admin\mh170085admin_Email\[email protected]_GV_strea…

Please help, thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service