How to get by Content-Id the attachements of a multipart response with PHP CURL -
i can't figure out how specific part of multipart http response. i'm trying pdf report jasper reports server sending soap on phpcurl , didn't find in curl documentation how handle multipart response. 'report' part of raw response below. help. ilyas
------=_part_6_9317140.1311257231623 content-type: text/xml; charset=utf-8 content-transfer-encoding: binary content-id: <b33d7700bfcf12cc2a64a7f6fb84ceae sutffs here ------=_part_6_9317140.1311257231623 content-type: application/pdf content-transfer-encoding: binary content-id: <**report**> binary pdf content here
try this:
<?php $str = '------=_part_6_9317140.1311257231623 content-type: text/xml; charset=utf-8 content-transfer-encoding: binary content-id: <b33d7700bfcf12cc2a64a7f6fb84ceae sutffs here ------=_part_6_9317140.1311257231623 content-type: application/pdf content-transfer-encoding: binary content-id: <**report**> binary pdf content here'; $pattern = '%content-type: application/pdf'."\n". 'content-transfer-encoding: binary'."\n". 'content-id: ([^\s]+)%'; preg_match($pattern, $str, $matches); echo $matches[1]; ?>
however, wouldn't vouch reliability, because structure of returned string might change @ time.
Comments
Post a Comment