Forum Discussion

coderafg's avatar
coderafg
New Contributor
6 years ago

Delete record by guid using PHP cURL

Can anybody help. Code error message is under the code. Thank you. 

 

<?php>

$data = array('guid'=>'{3C4AED24-A7B0-4537-9678-958402E31137}');
$data_json = json_encode($data);


/**********************test*******/
$service_url = "https://dd-gsee.de:55102/api/v1/shop/calendar/reservation/";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_USERPWD, $client_id.":".$client_secret); // AUTHORIZATION

curl_setopt($ch, CURLOPT_POST, 1); //Wouldn't work without it

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);


curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);

$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE); // this results 0 every time
$response = curl_exec($ch);

if ($response === false)
$response = curl_error($ch);
var_dump ($response);
curl_close($ch);
// end
?>

 

 

'HTTP/1.1 405 
Date: Mon, 01 Jul 2019 10:27:05 GMT
Content-Length: 0
Connection: keep-alive
Set-Cookie: JSESSIONID=C74E027C70203984E60499DF53E3C264; Path=/; Secure; HttpOnly
Allow: POST
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: DENY

 

  • nmrao's avatar
    nmrao
    Champion Level 3
    Not sure if this is related to SoapUI.