Forum Moderators: coopster & phranque

Message Too Old, No Replies

how to get the content from a URL?

about FORM

         

msgsbox

3:01 pm on Dec 11, 2006 (gmt 0)

10+ Year Member



I need to feed the content of a URL for example, 'http://www.sample.com/some.xml', into a form.

What I have done now is that,
1. open 'http://www.sample.com/some.xml' in a browser.
2. copy and paste the content of that page (or say content of some.xml) into a textarea.

Question:
Can I directly get content from a URL? Like below,
<input type="uri" name="xmlfile" size = "60">

Thanks.

maximillianos

9:07 pm on Dec 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could probably do it with AJAX. Basically have javascript make a call to retrieve the XML data, and then move/dump it into the textarea.

perl_diver

9:13 pm on Dec 11, 2006 (gmt 0)

10+ Year Member



look into modules like LWP and WWW::Mechanize or try the AJAX suggestion.

phranque

1:34 am on Dec 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



if you are doing this client side, search on "javascript xml http request" for examples.
if you are doing this server side, search on "perl lwp request" for examples.

check out LWP::Simple - it might be the way to go.