I’m trying to send data using php cUrl to cockpit form, but nothing happening. The form stays empty.
My test code looks like
$url = ‘https://my.site/api/forms/submit/partsForm?token=MyFancyTokenKey’;
$parts = [‘start’=>‘Hard’, ‘end’=>‘Disk’];
$ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['parts' => $parts])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $result = curl_exec($ch); curl_close($ch);
Do i need to set something in headers or different one to post data to the form?