Get A Website Using Curl (SSL Support)


/ Published in: PHP
Save to your folder(s)

This example will CURL a forum and echo it's contents using SSL support.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. function get_data($url) {
  4. $ch = curl_init();
  5. $timeout = 5;
  6. curl_setopt($ch, CURLOPT_URL, $url);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  9. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  10. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  11. $data = curl_exec($ch);
  12. curl_close($ch);
  13. return $data;
  14. }
  15.  
  16. $returned_content = get_data('http://faucetlove.com'); // Curl a bitcoin forum
  17. echo $returned_content;
  18.  
  19. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.