Location: PHPKode > scripts > HTTP CURL > http-curl/class.curl.php
<?php

# It's a Simple CURL class.
# Written By Eshan Chowdhury.
# BLOG http://eshan04.blogspot.com
# Please Help A Helpless Child.

class http
{
	
	private $ch;
	
	public function __construct($url = "")
	{
		$this->ch = curl_init($url);
		curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,true);
	}
	
	public function setURL($url)
	{
		curl_setopt($this->ch,CURLOPT_URL,$url);
	}
	
	public function saveCookie($file)
	{
		curl_setopt($this->ch,CURLOPT_COOKIEJAR,$file);
	}
	
	public function sendCookie($file)
	{
		curl_setopt($this->ch,CURLOPT_COOKIEFILE,$file);
	}
	
	public function setUA($ua)
	{
		curl_setopt($this->ch,CURLOPT_USERAGENT,$ua);
	}
	
	public function setProxy($proxy,$port,$pass = false)
	{
		curl_setopt($this->ch,CURLOPT_HTTPPROXYTUNNEL,1);
		curl_setopt($this->ch,CURLOPT_PROXY,$proxy);
		curl_setopt($this->ch,CURLOPT_PROXYPORT,$port);
		if ($pass)
		{
			curl_setopt($this->ch,CURLOPT_PROXYUSERPWD,$pass);
		}
	}
	
	public function post($array)
	{
		curl_setopt($this->ch,CURLOPT_POST,true);
		curl_setopt($this->ch,CURLOPT_POSTFIELDS,http_build_query($array));
	}
	
	public function exec()
	{
		return curl_exec($this->ch);
	}
	
	public function error()
	{
		return curl_error($this->ch);
	}
	
	public function errno()
	{
		return curl_errno($this->ch);
	}
	
	public function close()
	{
		curl_close($this->ch);
	}
	
}

?>
Return current item: HTTP CURL