[asterisk-users] CURL

Tzafrir Cohen tzafrir.cohen at xorcom.com
Thu Sep 21 12:13:42 MST 2006


On Thu, Sep 21, 2006 at 12:03:06PM -0600, Colin Anderson wrote:
> You need to use AGI to do this. 

Why not use the application or function Curl?

> You would put a shell script yourscript.agi
> in /var/lib/asterisk/agi-bin
>  
> If you want an HTTP response dumped into your dialplan as a variable, you
> would use wget:
>  
> myagi.agi:
>  
> #!/bin/bash
> TMPFILE=/tmp/$$.$RANDOM

instead of that:

set -e
TMPFILE=`mktemp`

> wget -q -t3 --output-document=$TMPFILE http://mysite.com/myhtml.html
> MYVAR=$(cat $TMPFILE)
> echo "SET VARIABLE MYASTERISKVAR \"$MYVAR\""
> rm $TMPFILE

-- 
Tzafrir Cohen         sip:tzafrir at local.xorcom.com
icq#16849755          iax:tzafrir at local.xorcom.com
+972-50-7952406          jabber:tzafrir at jabber.org
tzafrir.cohen at xorcom.com     http://www.xorcom.com


More information about the asterisk-users mailing list