Jump to content

kaf3773

New Members
  • Posts

    5
  • Joined

  • Last visited

kaf3773's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
  2. Thank you so much requinix I really appreciate this. How can i print out the items in the Array on their own. For instance how can i get just 18 16 10 15 17 [2] => Array ( [0] => 18 [1] => 16 [2] => 10 [3] => 15 [4] => 17 ) Thanks
  3. i tried it like you said where $content is a variable that holds the results of the table. preg_match_all('/^(\d+)\s+(\d+)%/m', $content, $match, PREG_PATTERN_ORDER); print_r($match[0]); This is what is printed out after runing the code. Help will really be appreciated Array ( )
  4. Hi I have a php script that executes a command to get the following results below I will appreciate it very much if you can help me with a php preg_match that can pick the percentage in the second column based on the supplied queue number in the first column Thanks in advance. ================================================================== QUEUE USAGE TOTAL book1 book2 ------------------------------------------------------------------ 0001 18% 822 481 98 0002 16% 345 765 88 0003 10% 400 300 166 0004 15% 994 322 177 0005 17% 348 297 131 ----------------------------------------------------------
×
×
  • 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.