Advertisement
Guest User

Untitled

a guest
Dec 9th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. $cm = curl_multi_init();
  4. $stuffs = curl_init();
  5. $curl_options = array(
  6.     CURLOPT_URL => 'http://www.google.ca',
  7.     CURLOPT_RETURNTRANSFER => 1,
  8.     CURLOPT_SSL_VERIFYHOST => 0,    // these are the problem
  9.     CURLOPT_SSL_VERIFYPEER => 0,    // toggle 0/1 to test
  10.     CURLOPT_HEADER => 1
  11. );
  12. curl_setopt_array($stuffs, $curl_options);
  13. curl_multi_add_handle($cm, $stuffs);
  14. do { curl_multi_exec($cm, $running); } while($running > 0);
  15. $content = curl_multi_getcontent($stuffs);
  16. $info = curl_getinfo($stuffs);
  17. curl_multi_remove_handle($cm, $stuffs);
  18. curl_multi_close($cm);
  19. print_r($info);
  20. // cuts off too much, the header size is incorrect
  21. echo mb_substr($content, $info['header_size']);
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement