Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2. $handleHeader = function ($curl, $header) {
  3.     if(strpos($header,'Set-Cookie') !== false){
  4.         $headerData = explode('; ',str_replace('Set-Cookie: ','',trim($header)));
  5.         var_dump($headerData);
  6.     }
  7.  
  8.     return strlen($header);
  9. };
  10.  
  11.  
  12. $ch = curl_init();
  13. curl_setopt($ch, CURLOPT_URL, "https://www.google.com");
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_HEADERFUNCTION, $handleHeader);
  16. $body = curl_exec($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement