[ic] How to include HTTP GET response in an IC page
Peter
peter at pajamian.dhs.org
Mon Jul 24 20:32:52 EDT 2006
On 07/24/2006 04:55 PM, DB wrote:
> On my IC-5.4 website I need to create a form with a single input field,
> the contents of which gets added to a HTTP GET request to a remote site.
> The reply to the request is if the format:
>
> HTTP/1.1 200 OK
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
>
> <?xml version="1.0" encoding="utf-8"?>
> <ArrayOfString xmlns="http://www.remote-site.com">
> <string>string</string>
> <string>string</string>
> </ArrayOfString>
>
>
> I want to extract the contents of the first instance of
> <string>string</string>, and display that on the form's results page.
> Can anyone help by example or point me to the proper docs?
Use the [get-url] tag
<http://www.interchange.rtfm.info/docs/frames/ictags_144.html> to fetch
the remote page, then use perl regular expressions to filter out the
content you want. Something like this should do it:
[calcn]
my $page = $Tag->get_url('http://www.example.com/mypage.xml');
$page =~ m!<string>(.+?)</string>!;
$1;
[/calcn]
Peter
More information about the interchange-users
mailing list