Hi All,
I have been using fsockopen() in a function in a class. I am able to pass all the objects in a class to another page except the fsockopen () value. I have put the values of objects from the output print_r() as below
main pages Class objects
Cisco Object
(
[_hostname:priva te] => 10.10.1.49
[_password:priva te] => cisco123
[_username:priva te] => cisco
[_connection:pri vate] => Resource id #3
[_data:private] => R3#
[_timeout:privat e] => 3
[_prompt:private] => #
)
Class values transfred to another page
Cisco Object
(
[_hostname:priva te] => 10.10.1.49
[_password:priva te] => cisco123
[_username:priva te] => cisco
[_connection:pri vate] => 0
[_data:private] => R3#
[_timeout:privat e] => 3
[_prompt:private] => #
)
In all other pages the [_connection:pri vate] value is resetting to 0. I have treid using class Cisco declaring class as SESSION. (session_regist er('cisco');) and global, but no hope.
Part of my code is
Thanks
I have been using fsockopen() in a function in a class. I am able to pass all the objects in a class to another page except the fsockopen () value. I have put the values of objects from the output print_r() as below
main pages Class objects
Cisco Object
(
[_hostname:priva te] => 10.10.1.49
[_password:priva te] => cisco123
[_username:priva te] => cisco
[_connection:pri vate] => Resource id #3
[_data:private] => R3#
[_timeout:privat e] => 3
[_prompt:private] => #
)
Class values transfred to another page
Cisco Object
(
[_hostname:priva te] => 10.10.1.49
[_password:priva te] => cisco123
[_username:priva te] => cisco
[_connection:pri vate] => 0
[_data:private] => R3#
[_timeout:privat e] => 3
[_prompt:private] => #
)
In all other pages the [_connection:pri vate] value is resetting to 0. I have treid using class Cisco declaring class as SESSION. (session_regist er('cisco');) and global, but no hope.
Part of my code is
Code:
class Cisco
{
private $_hostname;
private $_password;
private $_username;
private $_connection;
private $_data;
private $_timeout;
private $_prompt;
public function __construct($hostname, $password, $username, $timeout = 3)
{
$this->_hostname = $hostname;
$this->_password = $password;
$this->_username = $username;
$this->_timeout = $timeout;
}
public function connect()
{
$this->_connection = @fsockopen($this->_hostname, 23, $errno, $errstr, $this->_timeout);
// code continues ....
Comment