Skip to main content
September 9, 2010
Question

Is it possible to load web content?

  • September 9, 2010
  • 4 replies
  • 7300 views

Hello,

I'd like to know if its possible to load a file (an xml file) from a web resource with a given address like: http://server.com/file.xml.

I tried to do this with

myDocument.importXML(File(file));

but this does not seem to work.

Thanks in advance and kind regards,

mannyk

This topic has been closed for replies.

4 replies

Loic.Aigon
Legend
January 23, 2017

Nice

Loic.Aigon
Legend
January 23, 2017

@Trevor,

I tried to implement a product activation system with it but it didn't pass a large corporations firewall

Yeah I came into the same trouble

Nice that you could circumvent it somehow.

Trevor:
Legend
January 23, 2017

Hi Loic,

I won't post a working link but you can try out this one.

http://activation.creative-scripts.com/index.php/f72d9e737de8b2289d1a/elizabeth@palace.gov.uk/HRM/activate/

In a working one you would get a code and instructions of how activate the program with it.

You can have the script generate a random number and generate a matching link, the link will only work with that particular installation because only that installation will have that random number.  The link will automatically update the online SQL and once the links been used once it will no longer work.

With a bit of creativity should should be able to get a working system.

HTH

Trevor

Marc Autret
Legend
January 4, 2011

Also, you can perform HTTP requests very easily by using the http module of the Extendables library from Stijn Debrouwere, as demonstrated here:

http://www.indiscripts.com/post/2010/11/my-first-extendables-script-for-indesign

@+

Marc

Participant
January 4, 2011

Hi Marc,

Marc Autret
Legend
January 4, 2011

Hi Kris.

;-)

Kasyan Servetsky
Legend
September 9, 2010

Check out this podcast at Kris Coppieters' blog.

Kasyan

September 9, 2010

Hello,

thanks for the link. It helped to get the text of the web resource!

However, I don't know how I can import the xml text as an xml file.

var data = GetURL("http://server.com/xmlfile.xml",false);

myDocument.importXML(data.body);

does not work.

Regards,

mannyk

Jongware
Community Expert
Community Expert
September 9, 2010

What does "does not work" mean? (I.e., 'nothing happens at all', 'i get an error', 'my screen exploded', or something else.)

I would think importXML only works with a file, not with an internal string. If so, you should download the file, store it locally, then use importXML.