Hello,
I'd like to code a PHP class that enables dialog between a PHP script and an Edonkey server. This may sound crazy, but it's just for fun and knowledge 😉
So, what I've found so far is that it's possibile to open a connection with fsockopen, and then use the file pointer to write to server and read response :
// TCP Connect
$fp = fsockopen('tcp://'.$ip, $port, $errno, $errstr, $timeout);
stream_set_timeout($fp, $timeout);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
echo "Connected<br />\n";
}
return $fp;
Then I can use the fwrite function to "speak" to the server :
fwrite($fp, "\xE3\xA2");
And then read the server response with fread.
At this point, what I'm looking for is information about the "codes" I can send to the server and how to handle them back... For exemple, to log into a server, I have to build a packet that complies to ED2K protocol, like this :
OP_LOGINREQUEST = 0x01, //!< <hash>hash<u32>ip<u16>port<TagList>tags
But I can't find how to build this packet 🙁(
Is there anyone that can help me with this ???
Thanx.