Programming-Idioms

History of Idiom 183 > diff from v3 to v4

Edit summary for version 4 :
New PHP implementation by user [jesusflores.dev]

Version 3

2019-09-07, 16:53:28

Version 4

2019-09-26, 14:47:49

Idiom #183 Make HTTP PUT request

Make a HTTP request with method PUT to URL u

Idiom #183 Make HTTP PUT request

Make a HTTP request with method PUT to URL u

Imports
require ext-curl
Code
<?php

$url = 'http://localhost/tester/log.php';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$fields = array("id" => 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = curl_exec($ch);

echo $response;
Origin
https://thisinterestsme.com/send-put-request-php/