Posted By

Davis34 on 11/22/16


Tagged

curl get echo Website ssl forum


Versions (?)

Get A Website Using Curl (SSL Support)


 / Published in: PHP
 

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

  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  

You need to login to post a comment.