Get A Website Using Curl (SSL Support)


SUBMITTED BY: Guest

DATE: Nov. 22, 2016, 1:05 p.m.

FORMAT: Text only

SIZE: 579 Bytes

HITS: 807

  1. <?php
  2. // This example will CURL a forum and echo it's contents using SSL support.
  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. $returned_content = get_data('http://faucetlove.com');
  16. echo $returned_content;
  17. ?>

comments powered by Disqus