Example #1
0
 function curl($url, $post = NULL)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     if (isset($post)) {
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
     }
     $result = curl_exec($ch);
     self::$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     curl_close($ch);
     return $result;
 }