rest - PHP cURL HTTP PUT -


i trying create http put request curl , can't make work. i've read many tutorials none of them worked. here's current code:

$filedata = array('metadata' => $rdfxml); $ch = curl_init($url); $header = "content-type: multipart/form-data; boundary='123456f'"; curl_setopt($ch, curlopt_verbose, 1); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_customrequest, "put"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_httpheader, array($header)); curl_setopt($ch, curlopt_postfields, http_build_query($filedata)); $returned = curl_exec($ch);  if (curl_error($ch)) {     print curl_error($ch); } else {     print 'ret: ' .$returned; } 

i've tried using php pear got same result. problem repository says no metadata has been set. need help! thanks!

just been doing myself today... here code have working me...

$data = array("a" => $a); $ch = curl_init($url); 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; } 

src: http://www.lornajane.net/posts/2009/putting-data-fields-with-php-curl


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -