Build A Web Service In Yii

I wanna fetch a session from non-yii application into yii application. From some literature that i’ve been red, i found that the best solution is embedding a web service between them. Actually, i never try this. Could somebody give me some suggestion? thanks in advance :D

See Web Service section in the guide.

If you have problems druing coding you can ask your specific question here again.

this link may help you for webservices on yii

if you can explain your requirement clearly…it’d be easy for others to give you direct solution. if you have to work with authentication and xml this may be helpful…

you can use like this to access the xml file:

hope this is what you are loooking for


if you want to work with xml files this might be helpful:

to work with it…you can use something like this:

public function xyzRequest()


// Initialize the cURL session


$this->curl = curl_init();

//$file = Yii::getPathOfAlias('webroot.assets').'/somefile.xml';

//$fp = fopen("$file", "w");

curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);

curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookie);//$this->cookie(it is storing the session value and for every time we are performing authenticaiton before we process with our new request) is value is $this->cookie = Yii::getPathOfAlias('webroot.assets').'/cookie.txt';

curl_setopt($this->curl, CURLOPT_URL, '');

//curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);

//curl_setopt($this->curl, CURLOPT_FILE, $fp);

$result = curl_exec($this->curl);


//print $result;

//$out = ob_get_contents();