[eluser]nevsie[/eluser]
Hey all... i have two wonderful working examples..
1 works to write a value to a session if it did not previously exist, if it did exist no change...
2 uses the nusoap lib to connect to a client and pull back information. Note currently i am also using simplexml lib to parse the XML to an array for ease of use...
Individually they work fine... together a number of problems arise...
The first and most common is that when putting them together the session appears to be created but not saved as it does not exist on page refresh.
Also, there appears to be issues with regards to the headers "Cannot modify header information".
I am certainly no pro at this and i am just plugging my way through as i would prefer to build this as part of a framework, rather than straight from PHP. Any help, advice, reasons would be appreciated... a sample of the code is below for reference... hope you can help!
Note in the example below that session is autoloaded and the nusoap part and session part are not even directly linked... although that is the intention, hopefully!!!
Code:
<?php
class Home extends Controller {
function Home()
{
parent::Controller();
$this->load->library("Nusoap");
$this->load->library('simplexml');
}
function index()
{
$this->nusoap_client = new soapclient("http://mydomain.co.uk/WebServ.asmx?WSDL", true);
$params = array('psXMLParams' => '<?xml version="1.0" encoding="utf-8" ?><Connection><AName>Sample Name</AName></Connection>');
$result = $this->nusoap_client->call('Connection', $params);
$ConnectionResult = $this->simplexml->xml_parse($result["ConnectionResult"]);
if ($this->session->userdata('spam') != FALSE)
{
echo "yup got me some userdata from session - ".$this->session->userdata('spam');
echo "<pre>"; print_r($this->session->userdata); echo "</pre>";
}
else
{
$this->session->set_userdata(array('spam'=>'123456789'));
echo "New ConnID - Should now be in session!";
echo "<pre>"; print_r($this->session->userdata); echo "</pre>";
}
}
function logout() {
$this->session->set_userdata(array('spam'=>FALSE));
}
}
?>