Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $stdout = fopen( 'php://stdout', 'w' );
- function execute_agi( $command )
- {
- GLOBAL $stdin, $stdout, $stdlog, $debug;
- fputs( $stdout, $command . "\n" );
- fflush( $stdout );
- if ($debug)
- fputs( $stdlog, $command . "\n" );
- $resp = fgets( $stdin, 4096 );
- if ($debug)
- fputs( $stdlog, $resp );
- if ( preg_match("/^([0-9]{1,3}) (.*)/", $resp, $matches) )
- {
- if (preg_match('/result=([-0-9a-zA-Z]*)(.*)/', $matches[2], $match))
- {
- $arr['code'] = $matches[1];
- $arr['result'] = $match[1];
- if (isset($match[3]) && $match[3])
- $arr['data'] = $match[3];
- return $arr;
- }
- else
- {
- if ($debug)
- fputs( $stdlog, "Couldn't figure out returned string, Returning code=$matches[1] result=0\n" );
- $arr['code'] = $matches[1];
- $arr['result'] = 0;
- return $arr;
- }
- }
- else
- {
- if ($debug)
- fputs( $stdlog, "Could not process string, Returning -1\n" );
- $arr['code'] = -1;
- $arr['result'] = -1;
- return $arr;
- }
- }
- $wsdl = "http://192.168.10.23:82?wsdl";
- $options = array(
- 'cache_wsdl' => 0);
- $client = new SoapClient($wsdl, $options);
- echo '<pre>'.print_r($client,true).'</pre>';
- $response = $client->__soapCall('About', array());
- echo '<pre>'.print_r($response,true).'</pre>';
- #extract($agivars);
- $myFile = "/data/scripts/testCallerID.txt";
- $fh = fopen($myFile, 'w') or die("can't open file");
- $file_name = $argv[2]."-".$argv[1]."--".$client."---".$response;
- $vartest= '123456';
- execute_agi("SET VARIABLE ScriptResult $vartest");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement