json - php curl multipart/data-form content-type for each boundary -
i guess i'd know if possible post multipart/data-form content type containing json, files, txt, xml in same post. request this:
content-type: multipart/form-data; boundary=boundary --boundary content-type:application/json content-disposition:form-data {{"somejsonobject":"valueofobject"}} --boundary content-type:application/xml content-disposition:form-data <node>somexml nodes</node> --boundary--
know can code string, include boundaries manually, want know if possible via
curl_setopt($curl, curlopt_postfields, $data);
thank you
there no way post string data in post except building boundary curl can post files disk
file_put_contents('/tmp/fileforsend.json'); curl_setopt($curl, curlopt_postfields, array( 'file' =? '@/tmp/fileforsend.json;type=application/json', // curl integrared feature, curl read file ));
so putting '@' sybmol means curl must read file , put content post request
Comments
Post a Comment