<div>Yes.&nbsp; Jon is correct.</div>
<div>&nbsp;</div>
<div>$agi[str_replace(&quot;agi_&quot;,&quot;&quot;,$s[[0])] = trim($s[[1]);</div>
<div>&nbsp;</div>
<div>This line needs some work...&nbsp; Your brackets are mismatched.<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 6/2/06, <b class="gmail_sendername">Jon Farmer</b> &lt;<a href="mailto:viperdude_uk@yahoo.co.uk">viperdude_uk@yahoo.co.uk</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Yes you have a parse error in your PHP when I saved it locally and run it from the command line I got<br><br>
syntax error, unexpected '[', expecting ']' in test.php on line 33<br><br>Jon FarmerTelford, Shropshire, UK<br><br>----- Original Message ----<br>From: Matthew Warren &lt;<a href="mailto:mwarren@ru-intouch.com">mwarren@ru-intouch.com
</a>&gt;<br>To: <a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a><br>Sent: Friday, 2 June, 2006 3:32:10 PM<br>Subject: [Asterisk-Users] PHP-AGI help<br><br>Can someone help me with this AGI script to send an email.&nbsp;&nbsp;It just isn't
<br>working.&nbsp;&nbsp;The file is being called in the dialplan and is saved as em.agi<br>but it isn't sending the email.<br>#!/usr/bin/php4 -q<br>&lt;?php<br>ob_implicit_flush(true);<br>set_time_limit(6);<br>$in = fopen(&quot;php://stdin&quot;,&quot;r&quot;);
<br>$stdlog = fopen(&quot;/var/log/asterisk/my_agi.log&quot;, &quot;w&quot;);<br><br>// toggle debugging output (more verbose)<br>$debug = false;<br><br>// Do function definitions before we start the main loop<br>function read() {
<br>&nbsp;&nbsp;global $in, $debug, $stdlog;<br>&nbsp;&nbsp;$input = str_replace(&quot;\n&quot;, &quot;&quot;, fgets($in, 4096));<br>&nbsp;&nbsp;if ($debug) fputs($stdlog, &quot;read: $input\n&quot;);<br>&nbsp;&nbsp;return $input;<br>}<br><br>function errlog($line) {
<br>&nbsp;&nbsp;global $err;<br>&nbsp;&nbsp;echo &quot;VERBOSE \&quot;$line\&quot;\n&quot;;<br>}<br><br>function write($line) {<br>&nbsp;&nbsp;global $debug, $stdlog;<br>&nbsp;&nbsp;if ($debug) fputs($stdlog, &quot;write: $line\n&quot;);<br>&nbsp;&nbsp;echo $line.&quot;\n&quot;;
<br>}<br><br>// parse agi headers into array<br>while ($env=read()) {<br>&nbsp;&nbsp;$s = split(&quot;: &quot;,$env);<br>&nbsp;&nbsp;$agi[str_replace(&quot;agi_&quot;,&quot;&quot;,$s[[0])] = trim($s[[1]);<br>&nbsp;&nbsp;if (($env == &quot;&quot;) || ($env == &quot;\n&quot;)) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;}<br>}<br><br><br>&nbsp;&nbsp; $sender = &quot;<a href="mailto:prospect@talktomehomes.com">prospect@talktomehomes.com</a>&quot;;<br>&nbsp;&nbsp; $recipient = &quot;<a href="mailto:mwarren@cwgo.com">mwarren@cwgo.com</a>&quot;;
<br>&nbsp;&nbsp; $subject = &quot;call from someone&quot;;<br><br><br><br>&nbsp;&nbsp; $header = &quot;From: &quot; . $sender . &quot;\r\n&quot;;<br>&nbsp;&nbsp; $header.= &quot;Reply-to: &quot; . $sender . &quot;\r\n&quot;;<br><br><br>&nbsp;&nbsp; mail($recipient, $subject, $message, $header);
<br><br><br>fclose($in);<br>fclose($stdlog);<br><br>exit;<br>?&gt;<br><br>_______________________________________________<br>--Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br><br>
Asterisk-Users mailing list<br>To UNSUBSCRIBE or update options visit:<br>&nbsp;&nbsp;<a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br><br><br><br><br>
_______________________________________________<br>--Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br><br>Asterisk-Users mailing list<br>To UNSUBSCRIBE or update options visit:<br>
&nbsp;&nbsp;<a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Origination that includes real support!<br>
<a href="http://www.VoIPStreet.com">http://www.VoIPStreet.com</a>