I have an AGI application that queries a web app and uses it response. The web response contains newline characters, so when I do this:
my $returnval = $agi->get_variable(‘CURL’);
$agi->verbose($returnval);
I always get only the first “line” back (which is empty), which I assume is because the first line of the web’s response is a NEWLINE character.
I know that my call to curl is working fine, and on the console I start debug and see this:
AGI Rx << EXEC Curl myhost:8080/LookupByPhone/do/loo … 6105551212
AGI Tx >> 200 result=0
AGI Rx << GET VARIABLE CURL
AGI Tx >> 200 result=1 (
14204101-1
34895901-1
)
If I substitue a call to a static text file on the webserver, instead of the webapp, the value of $returnval is the first line of the file, and if I put into the file a single line containing any data, things work. So I know that the problem involves the fact that the response has more than one line, with newline characters.
My question is how do I get the CURL field value into a Perl variable so that I may work with it? I’m no Perl guru, but it appears to me that I can’t assign a string with embedded newlines to a scalar via “$AGI->get_variable”.
I’d really appreciate a tip on how to get the message in its entirety to a field so that I can work with it. I already know how to take it from that point on.
Thanks for any assistance you may offer.
Barry