PHP cURL HTTP PUT

To make an HTTP PUT request using PHP's cURL functions, you can use the following snippet:

<?php

// Initialize cURL session
$ch = curl_init();

// Set the URL, request method (PUT), and other options
curl_setopt($ch, CURLOPT_URL, "http://example.com/api/resource/123");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["field1" => "value1", "field2" => "value2"]));

// Execute the request and get the response
$response = curl_exec($ch);

// Close the cURL session
curl_close($ch);

?>

This will make a PUT request to the specified URL with the specified data. You can also add additional options to customize the request, such as setting HTTP headers or enabling SSL.

Watch a course Learn object oriented PHP

For more information about cURL and the available options, you can refer to the PHP documentation: http://php.net/manual/en/book.curl.php