Answer the question
In order to leave comments, you need to log in
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;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question