Page 1 of 1

udp query

Posted: Sat Jan 31, 2015 3:32 pm
by TADS
Hi all,

I wrote a script a while back to query a game server using PHP, it has always worked untill i got my new host and they are blocking "loopback" so i am unable to use my scripts.... here is a VERY BASIC udp script to get raw data back....
Code: Select all
<?php
$fp = fsockopen("udp://myip", myport, $errno, $errstr);
if (!$fp) {
    echo "ERROR: $errno - $errstr<br />\n";
} else {
    fwrite($fp, "\n");
    echo fread($fp, 8192);
    fclose($fp);
?>
this spits out my raw data and i do stuff with it in another script, but this will not run on my host and they have said....
fopen looks to be installed from what I can see but this could be being blocked or failing for another reason other than fopen not being available. It could be that the script is performing a loop back connection and this is blocked on our server so this would need to be changed to use a different connect to do what you are trying to do.
is there another way to query this udp port to get my data from the game server?

Thanks for your time
Kev