{"id":4786,"date":"2025-03-19T22:16:18","date_gmt":"2025-03-19T22:16:18","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=4786"},"modified":"2025-12-04T19:39:49","modified_gmt":"2025-12-04T19:39:49","slug":"put-request","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/curl\/put-request","title":{"rendered":"PUT request"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Sending a PUT request with query parameters in the URL<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$PostData = &#91;\n    'param1' => 'value1',\n    'param2' => 'value2'\n];\n\n  $Url = \"mydomain.org\/somefile.php\";\n  $Url .= '?' . http_build_query($PostData);      \/\/Append query parameters to URL\n  $ch = curl_init();\n  curl_setopt($ch, CURLOPT_URL, $Url);\n  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"PUT\");    \/\/This is a PUT request\n  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);    \/\/Follow any page redirects etc (optional)\n  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);       \/\/&lt;&lt;&lt;Include this for the output of curl to go to the curl_exec() output below instead of the browser screen\n  $CurlResult= curl_exec($ch);\n\n  \/\/If your output is json then you can decode it with this:\n  $DecodedJson = json_decode($CurlResult);\n  echo \"CurlResult: \";\n  print_r($CurlResult);\n  echo \"&lt;br>DecodedJson: \";\n  print_r($DecodedJson);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sending a PUT request with query parameters in the URL<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[],"class_list":["post-4786","post","type-post","status-publish","format-standard","hentry","category-curl"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=4786"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4786\/revisions"}],"predecessor-version":[{"id":5247,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4786\/revisions\/5247"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=4786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=4786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=4786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}