[ic] How to include HTTP GET response in an IC page
Peter
peter at pajamian.dhs.org
Wed Jul 26 18:09:57 EDT 2006
On 07/26/2006 09:55 AM, DB wrote:
> The tag works if I use it like this:
> [get-url "http://example.com/mypage.xml"]
>
> ...However if I try
>
> [calcn]
> my $page = $Tag->get_url('http://www.example.com/mypage.xml');
> $page =~ m!<string>(.+?)</string>!;
> $1;
> [/calcn]
>
> then all I see is 0
Try it with just the first line in the [calcn] (without the regexp and
the $1). That will tell you if it's the get_url that's failing or the
regexp.
> I tried escaping the / using
You only have to escape the / if the regexp is bounded by /. That's why
I used ! to bound the regexp.
> Can anyone help me figure out what's wrong ?
You may not be able to run it from the calc block, try this:
[tmp result][get_url http://www.example.com/mypage.xml][/tmp]
[calcn]
$Scratch->{result} =~ m!<string>(.+?)</string>!;
$1;
[/calcn]
Peter
More information about the interchange-users
mailing list