<?php


class Curl {


	var $channel;


    


	 function curl() 


     {


		$this->channel = curl_init ();


		// you might want the headers for http codes


		curl_setopt ( $this->channel, CURLOPT_HEADER, 0 );


		curl_setopt ( $this->channel, CURLOPT_HTTPHEADER, array (


            'Content-Type: application/xml',


            'Accept: application/xml' 


            ) );


		// you may need to set the http useragent for curl to operate as


		curl_setopt ( $this->channel, CURLOPT_USERAGENT, $_SERVER ['HTTP_USER_AGENT'] );


		// you wanna follow stuff like meta and location headers


		curl_setopt ( $this->channel, CURLOPT_FOLLOWLOCATION, FALSE );


		// you want all the data back to test it for errors


		curl_setopt ( $this->channel, CURLOPT_RETURNTRANSFER, true );


		curl_setopt ( $this->channel, CURLOPT_VERBOSE, false );


		curl_setopt ( $this->channel, CURLOPT_SSL_VERIFYPEER, false );


		curl_setopt ( $this->channel, CURLOPT_SSL_VERIFYHOST, 0 );


	}


    public function curl_json($url) 


	{


		$this->channel = curl_init ();


		curl_setopt($this->channel,CURLOPT_URL,$url);


		curl_setopt($this->channel,CURLOPT_RETURNTRANSFER,1);


		$response = curl_exec($this->channel);


		// Close the cURL session


		curl_close ( $this->channel );


		return $response;


	}


    


	 function makeRequest($url, $vars) 


     {


		// if the $vars are in an array then turn them into a usable string


		if (is_array ( $vars )) :


			$vars = implode ( '&', $vars );


		endif;


		// setup the url to post / get from / to


		curl_setopt ( $this->channel, CURLOPT_URL, $url );


		curl_setopt ( $this->channel, CURLOPT_POST, true );


		curl_setopt ( $this->channel, CURLOPT_POSTFIELDS, $vars );


		// get data


		$response = curl_exec ( $this->channel );


		// Close the cURL session


		curl_close ( $this->channel );


		


		return $response;


	}


}





?>