Jump to content

PHP support for expect in Solaris


Recommended Posts

Hello All,

 

I installed php5 from OpenCSW but i believe it does not support the expect module.

I tried to run a php script to call expect to do a telnet to a device but i got this error

 

PHP Warning: fopen(): Unable to find the wrapper "expect" - did you forget to enable it when you configured PHP? in /export/home/php_expect.php on line 5

 

I will appreciate very much if you can help me configure the expect wrapper into php.

 

here is the script i was trying to use to test

 

 

<?php

ini_set("expect.loguser", "Off");

 

$stream = fopen("expect://ssh root@remotehost uptime", "r");

 

$cases = array (

array (0 => "password:", 1 => PASSWORD)

);

 

switch (expect_expectl ($stream, $cases)) {

case PASSWORD:

fwrite ($stream, "password\n");

break;

 

default:

die ("Error was occurred while connecting to the remote host!\n");

}

 

while ($line = fgets($stream)) {

print $line;

}

fclose ($stream);

?>

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/273758-php-support-for-expect-in-solaris/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.