function CurlGet($link, $postArr = '', $ssl = true, $timeout = 30, $userAgent = PSDO_CURL_UA) {
if ($curl = curl_init()) {
curl_setopt($curl, CURLOPT_URL, $link);
if ($postArr != '') {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArr);
}
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $ssl);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $ssl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
$rawResponse = curl_exec($curl);
if(curl_errno($curl)) {
RedirectError('1002', curl_errno($curl));
}
curl_close($curl);
return $rawResponse;
} else RedirectError('1002'); // curl init error
RedirectError('1002', '0000');
}