AGI Control WebService

Hello.
The idea is if i call the extension 1001 and then for example press the button 1 that mean i’m going to have lunch and send the num of the phone and the date in the web service, if i press the button 2 that mean end of the day (is a control presence idk if that means the same in English)

But i’m really new at this and idk how to start i have this:

extensions_custom.conf

[ivr]
exten => 1001,1,AGI(agi.php)
exten => n,Hangup()

Agi.php

/usr/bin/php -q
answer();

<?php set_time_limit(0); require_once "phpagi.php"; $agi = new AGI(); $agi->answer(); CONECTION $res=file_get_contents("http://IP CALLERID $callernum=$agi->get_variable("CALLERID(number)"); $callernum=$callernum['Telefono']; ?>

Some help, please.
Thanks.

PD: Don’t flame me for the code D:

I think the first assignment to $callernum is dead, and the second is unset.

Rather than reading an option, why not make it the fifth digit of the extension number?

I would see whether you could use curl to access your server, directly from the dialplan.

you can complete this task in multiple ways, but as you are newbie with Asterisk. I suggest you do it all in the dial plan instead of phpagi. It is a simple IVR , you can use curl to submit the data to the web server. for example save the values in a variable or multiples ones

same=>n,Set(INFO=${STRFTIME(${EPOCH},%Y-%m-%d_%H-%M-%S)}_${CALLERID(num)})