Skip to content

Instantly share code, notes, and snippets.

@tracend
Created April 5, 2011 06:07
Show Gist options
  • Save tracend/903103 to your computer and use it in GitHub Desktop.
Save tracend/903103 to your computer and use it in GitHub Desktop.
PHP: PUTting data fields with PHP cURL - Source: http://www.lornajane.net/posts/2009/PUTting-data-fields-with-PHP-cURL
$data = array("a" => $a);
$ch = curl_init($this->_serviceUrl . $id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($data));
$response = curl_exec($ch);
if(!$response) {
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment