json post edeceksiniz.
curl postfields query string yerine json olacak ve header olarak da content-type: application/json gönderilmesi gerekiyor.
$data = [
'siteUrl' => 'https://siteadresi.com',
'urlList' => [
'https://siteadresi.com/sayfa1',
'https://siteadresi.com/sayfa2',
],
];
$ch_options = [
CURLOPT_URL => $api_url,
CURLOPT_POST => true,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => 'Content-Type: application/json',
];
$ch = curl_init();
curl_setopt_array($ch, $ch_options);
$response = curl_exec($ch);
Merhabalar, yukarıdaki kodları yazdığımız dosyayı public_html ya da httpdocs içerisine mi atmamız gerekiyor?