how to run a function in controller?

hi, i am newbie. i tried to call a function in same controller.

but its getting error…

Fatal error: Call to undefined function make_request()

how can i fix it?

my controller codes




public function actionIndex(){


    ....


       $furl = make_request('the url address? client_id=' . $app_id . '& redirect_uri=' . $base_url.'&client_secret=' . $secret . '&code=' . $code);


    ....


}




function make_request($url, $params=array())

	{

		$ch = curl_init();

		$opts = array(

		CURLOPT_CONNECTTIMEOUT => 10,

		CURLOPT_RETURNTRANSFER => true,

		CURLOPT_TIMEOUT => 60,

		CURLOPT_USERAGENT => 'facebook-php-2.0',

		CURLOPT_POST => FALSE,

		);


		if (count($params))

		$opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');


		$opts[CURLOPT_URL] = $url;

		if (isset($opts[CURLOPT_HTTPHEADER]))

		{

			$existing_headers = $opts[CURLOPT_HTTPHEADER];

			$existing_headers[] = 'Expect:';

			$opts[CURLOPT_HTTPHEADER] = $existing_headers;

		}

		else

		{

			$opts[CURLOPT_HTTPHEADER] = array('Expect:');

		}


		curl_setopt_array($ch, $opts);

		$result = curl_exec($ch);

		if ($result === false)

		{

			die('error');

		}

		curl_close($ch);

		return $result;

	}




$this->make_request(...);

You’ll also probably want to at least put:


protected function make_request(...){


.....


}

thank you pommeverts…