Submit Sitemap With PHP

I have been tyring to get this api working for literally hours. I can't even get the try this api part working with api key. I tried to use it with cURL like this:

$submitSite = curl_init($submit_url);

curl_setopt_array($submitSite, [CURLOPT_PUT => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Accept: application/json"]]);
$responseContent = curl_exec($submitSite);

But it returns 0. I url encoded siteUrl and feedpath parts and added the api key at the end. How can I submit my website's sitemap automatically?

1 answer