pass PHP $variable to expect
Posted: Wed Aug 05, 2009 11:42 pm
Anyone know how to pass a variable known in my php code to an expect script? here's a slimmed down version of what I have...
PHP
Expect (tcl)
Thanks in advance!
PHP
Code: Select all
<?php
$address = "192.168.0.1";
print("trying to pass $address to the expect script");
print("<br/>");
exec("expect telnet.exp $address");
print("<br/>see if it worked");
?>
Expect (tcl)
Code: Select all
#! /usr/bin/expect -f
set timeout 20
set address [lindex $argv 0]
log_file log.txt
spawn telnet $address
close