Is it possible in phpAGI script

i am trying to connect to my external hosted mysql db of website using a class file (API) with in agi script and get back the result variable back to agiscript and from there to dialplan.Here is my code

my classfile(api) :calleridverification.php

class CallerIdVerification{
var $clientid = "jambodium";
var $clientsecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
var $url = "http://xxxxxxxxxxxxxxxxxx/callerverify.php";
var $postfields;
var $callerid;

function __construct() {

function CallerVerify($caller_id=''){
	$resp = 0;
	$this->callerid = trim($caller_id);
	//$this->url .= '?clientid='.$this->clientid.'&clientsecret='.$this->clientsecret.'&callerid='.$this->callerid;
	$this->postfields .= "clientid=".$this->clientid."&clientsecret=".$this->clientsecret."&callerid=".$this->callerid;
	//echo $this->url.'<br />';
	$resp = $this->getCURL();
	return $resp;

function getCURL(){
	// Get cURL resource
	$curl = curl_init();
	// Set some options - we are passing in a useragent too here
	curl_setopt($curl, CURLOPT_URL, $this->url);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_POST, 1);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $this->postfields);
	// Send the request & save response to $resp
	$resp = curl_exec($curl);
	//echo $this->url;
	//echo $resp;
	$resultmob = NULL;
	// Show ERROR message if $resp is FALSE
		echo 'Error: ' . curl_error($curl) . ' - Code: ' . curl_errno($curl);
		$resparr = json_decode($resp,true);
		$resultmob = (count($resparr)>0)?$resparr['resultmob']:NULL;
	// Close request to clear up some resources
	//return $resp;
	return $resultmob;


and my phpagi script:workingagi.php

#!/usr/bin/php -q 
error_reporting (E_ALL ^ E_NOTICE);
$agi=new AGI();
/* variable $argv[1] is callerid from dialplan*/
$civ = new CallerIdVerification();
$resultmob = $civ->CallerVerify($callerid);

/* sending variable $resultmob back to dial plan */

i executed in shell as well as in asterisk it wont take any thing from class file (api).please let me know how to solve this …thank you

Solved working fine…