1

How to get the boundary in this header?

$header = 'Content-Type: multipart/report; report-type=delivery-status;'."\n"
.'    boundary="9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho"';

preg_match('/Content-Type:(.*)boundary="([^\"]+)"/i', $header, $match);
print_r($match);

output

9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
clarkk
  • 27,151
  • 72
  • 200
  • 340

2 Answers2

1

Try this

preg_match('/boundary="(.*?)"/i', $header, $match);

or

preg_match('/Content-Type:(.*)\n*\s*boundary="([^\"]+)"/i', $header, $match);

Output

9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
Tim007
  • 2,557
  • 1
  • 11
  • 20
1
preg_match('/boundary=(.*)/', $header, $match);
rm_beginners
  • 164
  • 5