Hi, I've been trying to work out what this code does, because I'm trying to rewrite it in Java.
This code it mean to connect to a socket, get some some jibberish, and convert it to a number that represents how many people are currently useing an online mmog. I've worked out that it connects to a socket, get's the info, takes peices
19 and 20, puts them together, and this is what it formats.
The line's I'm totaly stuck on are "$serv1 = ord($serv1{0})|(ord($serv1{1})<<8)|(ord($serv1{2})<<16)|(ord($serv1{3})<<24);
$serv2 = $buf[18];
$serv2 = ord($serv2{0})|(ord($serv2{1})<<8)|(ord($serv2{2})<<16)|(ord($serv2{3})<<24);"
I've found out what 'ord' means, what I dont know is what all the {int} 's, <<, and | mean. I have really made an effort to look for these symbols, but google wont let me search for them 🙁 So I've had a lot of fruitless searching to do 🙁
Anyways, here's the completed code, any help is really appreciated 🙂
<?php
$fp = fsockopen('157.157.139.10',26000);
$buf = fgets($fp,128);
fclose($fp);
$serv1 = $buf[19].$buf[20];
$serv1 = ord($serv1{0})|(ord($serv1{1})<<8)|(ord($serv1{2})<<16)|(ord($serv1{3})<<24);
$serv2 = $buf[18];
$serv2 = ord($serv2{0})|(ord($serv2{1})<<8)|(ord($serv2{2})<<16)|(ord($serv2{3})<<24);
print 'Standart Server: '.$serv1."<br>\n";
print 'Dev Server: '.$serv2."<br>\n";
?>p