Yii Framework Forum: Build A Web Service In Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Build A Web Service In Yii in order to get session another application Rate Topic: -----

#1 User is offline   mbaksri 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 15-July 11

Posted 18 January 2013 - 02:58 AM

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
0

#2 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 289
  • Joined: 23-July 10

Posted 18 January 2013 - 03:18 AM

See Web Service section in the guide.

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

#3 User is offline   developer! 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 110
  • Joined: 28-November 12

Posted 18 January 2013 - 05:51 AM

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


Yii::app()->baseUrl.'/protected/components/somefile.xml'



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

//ob_start();


$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, 'http://remoteurl.website.com/xyz/');

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


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


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

curl_close($this->curl);

//print $result;

//$out = ob_get_contents();

var_dump($result);




Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users