PHP cURL HTTP PUT

Ich versuche zum erstellen einer HTTP-PUT-request mit cURL und ich kann nicht damit es funktioniert. Ich habe gelesen, viele Anleitungen, aber keine von Ihnen funktionierte. Hier ist meine aktuelle 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;
}

Habe ich auch versucht, mit Hilfe von PHP PEAR bekam aber das gleiche Ergebnis. Das problem ist, dass das repository sagt, dass keine Metadaten festgelegt wurde. Ich brauche wirklich Hilfe! Danke!

InformationsquelleAutor der Frage user601513 | 2011-02-18

Schreibe einen Kommentar