Welcome Guest, Not a member yet? Register   Sign In
Using PHP telnet library with codeigniter
#1

[eluser]misterix[/eluser]
Hello guys.

I hope that you will have a minute to take a look and help for me.

I am trying to use telnet library with codeigniter. This is working with pure PHP.

I found this library there:

http://www.soucy.org/project/cisco/
http://www.soucy.org/project/cisco/source.php

I took that source.php file and add to our codeigniter library folder (changed the name to Cisco.php) .

The problem is when I try to use it on my controller I get these errors:


Quote:A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Cisco::__construct(), called in /var/www/system/core/Loader.php on line 1099 and defined

Filename: libraries/Cisco.php

Line Number: 59
A PHP Error was encountered

Severity: Warning

Message: Missing argument 2 for Cisco::__construct(), called in /var/www/system/core/Loader.php on line 1099 and defined

Filename: libraries/Cisco.php

Line Number: 59
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: hostname

Filename: libraries/Cisco.php

Line Number: 61
A PHP Error was encountered


Severity: Notice

Message: Undefined variable: password

Filename: libraries/Cisco.php

Line Number: 62
A PHP Error was encountered

Severity: Warning

Message: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known

Filename: libraries/Cisco.php

Line Number: 72
A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to :23 (php_network_getaddresses: getaddrinfo failed: Name or service not known)

Filename: libraries/Cisco.php

Line Number: 72


Looks like my controller doesn't understand these variables.

telnet function on the controller looks like this:
Quote: public function telnet() {

$this->load->library('Cisco');

$cisco = array('10.0.0.1', 'pass123', 'cisco');

$this->cisco->connect($cisco);

What should I add there? :/

Thank you guys if you have a minute..
#2

[eluser]misterix[/eluser]
nothing to add? :/
#3

[eluser]jmadsen[/eluser]
you need to pass your vars to the initialization, not the connect() function

look at the code in the library
#4

[eluser]misterix[/eluser]
Could you give an example please?
#5

[eluser]neilmcgann[/eluser]
It's all there in the error messages. The constructor needs some parameters.

See the CI manual for the loader class and look at the optional $config parameter for load->library.
#6

[eluser]Ajaxboy[/eluser]
http://ellislab.com/codeigniter/user-gui...oader.html




Theme © iAndrew 2016 - Forum software by © MyBB