How to properly use PHP pack() function to send data via a socket?
<p>I'm trying to configurate connection to a server and need to use PHP pack() function to pack and send the following data:
WriteInt(1)
WriteInt(16)
WriteInt(0)
WriteInt(0)</p>

<p>The script so far is:</p>

<pre><code>&lt;?php
$fp = fsockopen("111.111.10.55", 5199, $errno, $errstr, 10);
if (!$fp) {
    echo "$errstr ($errno)&lt;br /&gt;\n";
} else {
    fwrite($fp, "You message");
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?&gt;
</code></pre>

<p>How should I go around packing the data and then sending it to the server via php?</p>

<p>Thank you!</p>
