-
[PHP] HTTP Wrapper Class
PHP Code:
class Wrapper {
public function Post($Url, $Variables){
if(!function_exists("curl_version")) return false;
$Handle = curl_init();
curl_setopt($Handle, CURLOPT_URL, $Url);
curl_setopt($Handle, CURLOPT_POST, 1);
curl_setopt($Handle, CURLOPT_POSTFIELDS, $Variables);
curl_setopt($Handle, CURLOPT_HEADER , 0);
curl_setopt($Handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($Handle, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($Handle);
}
public function Get($Url){
if(!function_exists("curl_version")) return false;
$Handle = curl_init();
curl_setopt($Handle, CURLOPT_URL, $Url);
curl_setopt($Handle, CURLOPT_HEADER , 0);
curl_setopt($Handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($Handle, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($Handle);
}
}