daily pastebin goal
85%
SHARE
TWEET

Untitled

a guest Jan 12th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CURL Request crashes SSL
  2. private function request($url, $params, $method = "GET") {
  3.         if ($method == "GET")
  4.             $url = $this->structGET($url, $params);
  5.         $ch = curl_init($url);
  6.         curl_setopt($ch, CURLOPT_URL, $url);
  7.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8.         if (isset($_SERVER['HTTP_USER_AGENT'])) {
  9.             curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  10.         } else {
  11.             curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13.');
  12.         }
  13.         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  14.  
  15.         $header[] = 'Accept-Language: EN';
  16.         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  17.         if ($method == "POST") {
  18.             curl_setopt($ch, CURLOPT_POST, true);
  19.             if ($params)
  20.                 curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
  21.         }
  22.         $result = curl_exec($ch);
  23.         curl_close($ch);
  24.         return $result;
  25.     }
  26.    
  27. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  28.    
  29. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    
  30. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top