R
R
Ruslan Absalyamov2021-08-06 12:41:18
PHP
Ruslan Absalyamov, 2021-08-06 12:41:18

How to connect to the server using the fix protocol?

It's a little unclear how to connect to the server using the fix protocol using php.

$host = "ssl://fix-order.london-demo.lmax.com";
        $port = "443";

        $fixv = "8=FIX.4.4";
        $clid = "LOGIN";
        $password = "*******";
        $tid = "LMXBD";
        $s = "\001"; //separator


        $fp = fsockopen($host, $port, $errno, $errstr, 30);
        if (!$fp) {
            echo "$errstr ($errno)<br />\n"; //i get no error
        } else {
            $out = $fixv.$s.
                "9=102".$s.
                "35=A".$s.
                "34=1".$s.
                "49=$clid".$s.
                "52=20210803-22:05:06".$s.
                "56=$tid".$s.
                "553=$clid".$s.
                "554=$password".$s.
                "98=0".$s.
                "108=30".$s.
                "141=Y".$s.
                "10=011";
            echo "\n".$out."\n"; //just checking what I'm sending
            fwrite($fp, $out);
            fflush($fp);
            while (!feof($fp)) {
                var_dump(fgets($fp, 1024));
                echo "\n.\n";  //nothing comes out of this (except for the dot)
                echo fgets($fp, 1024);
            }
            fclose($fp);
        }
        return;

But it always returns false for me and I don’t understand how to implement this using php. I asked those supporters, they say that they don’t see my requests and send ssl configurations and logs, in fact, as I understand it, it connects to the server but does not send any requests

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inFureal, 2021-08-06
@inFureal

Where is the certificate?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question