Hi guys, I'm trying to place orders with multiple instructions via php. The problem is that sometimes the call is succesfully executed by betfair, sometimes I got an empty reply
this is my php code
$params is this:
Can you see what is wrong?
Thank you
this is my php code
PHP Code:
$obj_data = json_encode(
array(
array(
'jsonrpc' => "2.0"
, 'method' => "SportsAPING/v1.0/" . $operation
, 'params' => json_decode($params)
, 'id' => 1
)
)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.betfair.com/exchange/betting/json-rpc/v1");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-Application: ' . $appKey
, 'X-Authentication: ' . $sessionToken
, 'Accept-Encoding: gzip, deflate'
, 'Content-Type: application/json'
, 'Connection: keep-alive'
));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60); //timeout in seconds
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_POSTFIELDS, $obj_data);
$res = curl_exec($ch);
if ($operation == 'placeOrders') {
error_log('reply from '.$operation.': '.$res);
}
$reply = json_decode($res);
curl_close($ch);
PHP Code:
stdClass Object
(
[marketId] => 1.131280549
[customerStrategyRef] => HRS_LAY_FLD
[instructions] => Array
(
[0] => stdClass Object
(
[selectionId] => 12139787
[handicap] => 0
[side] => LAY
[orderType] => LIMIT
[limitOrder] => stdClass Object
(
[size] => 6.67
[price] => 1.75
[persistenceType] => PERSIST
)
)
[1] => stdClass Object
(
[selectionId] => 9987211
[handicap] => 0
[side] => LAY
[orderType] => LIMIT
[limitOrder] => stdClass Object
(
[size] => 6.67
[price] => 1.75
[persistenceType] => PERSIST
)
)
)
[async] =>
)
Thank you


Comment