function connect_curl($url = '', $use_post = false, $vars = '', $return_data = 1, $timeout = 5, $ssl_verify_peer = false, $cert = '') { $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, $return_data); // Returns response data instead of TRUE(1) if($cert != '') { curl_setopt($ch, CURLOPT_SSLCERT, $cert); } if ($use_post == true) { curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $vars, "& " )); // use HTTP POST to send form data } curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CURL_SSL_VERIFYPEER); // uncomment this line if you get no gateway response. ### if($cert != '') { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); } if (CURL_PROXY_REQUIRED == true) { curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, CURL_PROXY_TUNNEL_FLAG); curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS); } $resp = curl_exec($ch); //execute post and get results curl_close ($ch); return $resp; }