AGI with your code in C#

Good morning!

I have an AGI with your code in PHP.

The AGI is a query in a Webservice, XML and this one returns me a value.
I want the same AGI in the place I need PHP to C#

Somebody help me? The AGI is enclosed in PHP.

Thank you.

File AGI with your code in PHP

#!/usr/bin/php -q

<?php ob_implicit_flush(true); set_time_limit(6); error_reporting(0); $in = fopen("php://stdin","r"); $stdlog = fopen("/var/log/asterisk/teste.log","w"); // Habilita modo debugging (mais verbose) $debug = true; // Funcoes necessarias function read() { global $in, $debug, $stdlog; $input = str_replace("\n", "", fgets($in, 4096)); if ($debug) fputs($stdlog, "read: $input\n"); return $input; } function write($line) { global $debug, $stdlog; if ($debug) fputs(stdlog, "write: $line\n"); echo $line."\n"; } // Coloca os headers AGI dentro de um array while ($env=read()) { $s = split(": ",$env); $agi[str_replace("agi_","",$s[0])] = trim($s[1]); if (($env == "") || ($env == "\n")) { break; } } // Programa Principal write("GET VARIABLE OPCAO"); $c = read(); $opcao = substr($c,14); $opcao = substr($opcao,0,-1); $arquivo = file_get_contents("http://selos.climatempo.com.br/selos/selo.php?&DIA&CODCIDADE=".$opcao); // Criando a variavel SimpleXMLElement $xml = simplexml_load_string($arquivo); // Atribui o valor a uma variavel $valor = $xml->cidade[0]["high"]; //Fala o numero inteiro write("EXEC SayNumber \" $valor \"\n"); write("EXEC Playback reais \n"); //Fala um numero de cada vez (usado para confirmar digitacao) //write("EXEC SayDigitis \" $valor \"\n"); //write("EXEC SayPhonetic \" $valor \"\n"); read(); fclose($in); fclose($stdlog); exit; ?>

See asterisk-dotnet.sourceforge.net/
(FastAGI with C# part)