Try the below code and if there is any authentication please include them..
POST Means the data should be passed as post request
-d Means The data you should pass in the request
//the data you should passed
$data = array(
"instrument" => 'EUR_USD',
"units" => "1000",
"side" => "buy",
"type" => "market",
);
//encode it as json to become a string
$data_string = json_encode($data);
// print_r($data_string);
$curl = curl_init('https://api-fxpractice.oanda.com/v1/accounts/6531071/orders');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
//the content type(please reffer your api documentation)
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//set post data
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
$result = curl_exec($curl);
curl_close($curl);//close the curl request
if ($result) {
print_r($result); // print the response
}
Plese reffer Curl for more information