Advertisement
fahmihilmansyah

Untitled

Mar 6th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. $result = '
  4. Set-Cookie: JSESSIONID=yhzTc1tKPhkG6JCpwmp2dnBvXQh2wms6BhFQ2SFw4h11nXcrX1Nh!-540208961!-1602043628; path=/; HttpOnly=
  5. Set-Cookie: nlbi_1952216=ylNNQOC8pxFMPedUYnRKaAAAAADWj8CkedHLW9kKCNW1QoNM; path=/; Domain=.test1234.co.id
  6. Set-Cookie: incap_ses_1118_1952216=YeAZMUpEKQjCnBZ8S++DD16uf1wAAAAA0q/urtrNxUnveCXfOg+hTg==; path=/; Domain=.test1234.co.id
  7. ';
  8. preg_match_all('/^Set-Cookie:\s*([^;]*)/miu', $result, $matches);
  9. $cookies = array();
  10. foreach($matches[1] as $item) {
  11. parse_str($item, $cookie);
  12. $cookies = array_merge($cookies, $cookie);
  13. }
  14. echo "<pre>";
  15. print_r($cookies);
  16.  
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement