views:

41

answers:

1

Hello, I want to ask this question because the php documentation doesn't mention it

How would one put xml data and binary data together?

$imagecontent = @file_get_contents($imagelocation);
$xmldata ="<xml></xml>";
$headers = array("MIME-version: 1.0");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);

I know that if you pass $data as an array, curl automaticly is set to multipart, but how can you associate the different content types with the different contentvariables?

$xmldata
$imagecontent
Content-Type: application/atom+xml
Content-Type: "jpg"

I have some sample wich is done with fputs and is more inline and uses boundary. I don't know if you also have to do that with curl and if so how to do it?

Can anyone provide some samplecode please?

thanks, Richard

A: 

I've just found answer to similar question and it can be useful for you.

Ula Karzelek