Create Order with API

Hello
I wrote this code for feature market and working:

function create_limit_order($apiKey,$secretKey,$symbol,$price,$quantity,$side)
{
$url = “https://www.binance.com/fapi/v1/”;
$timestamp = time()*1000;
$data = array(
“symbol” => $symbol,
“type” => “LIMIT”,
“quantity” => $quantity,
“price” => $price,
“timestamp” => $timestamp,
“side” => $side,
“timeInForce” => “GTC”,
);
$data = http_build_query($data);
$signature = hash_hmac(‘sha256’,$data,$secretKey);
$url = $url . “order?” . $data . “&signature=” . $signature;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "X-MBX-APIKEY: " . $apiKey,
    "Content-Type: application/json"
));

$respone  = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($respone, true);
print_r($result);
return $result;

}

I want change it and working with spot market for this I changed $url to below link:
$url = “https://api.binance.com/api/v3/order”;

but it does not working.
could you help me?

Hey,
Could you provide more details about the error you’re encountering? It would help us in better understanding and resolving the issue.

Change
this → $url = “https://www.binance.com/fapi/v1/”;
with this → $url = “https://www.binance.com/”;

Also change
this → $url = $url . “order?” . $data . “&signature=” . $signature;
with this → $url = $url . “/api/v3/order?” . $data . “&signature=” . $signature;

However, i would send endpoint as an arg