get URL odd behaviour

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

get URL odd behaviour

Post by thatkeith » Wed Nov 05, 2014 6:52 pm

This seems basic, but I'm getting an unexpected result for the particular 'get URL' line I'm trying. I'm calling the URL from Wikipedia's Random Article link:

Code: Select all

get URL "https://en.wikipedia.org/wiki/Special:Random"
If I put the result (because I wasn't getting the expected HTML code) I get this:

Code: Select all

error Redirect failed https://en.wikipedia.org/wiki/Amor_asteroid
(Of course the exact URL will be different every time.)

Is this because I'm not actually requesting a specific file? Is there any way to fetch this URL in LiveCode? :?

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Re: get URL odd behaviour

Post by thatkeith » Wed Nov 05, 2014 7:17 pm

What's really odd is that I seem to have success occasionally, randomly.

I'm trying to build a simple tutorial so I can introduce some students to LiveCode tomorrow. Any comments on this? If I can't make this reasonably reliable I may have to take this a different direction. :(

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: get URL odd behaviour

Post by jacque » Wed Nov 05, 2014 8:55 pm

You could try setting the libUrlFollowHttpRedirects to true (see dicionary.) Worth a shot.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Re: get URL odd behaviour

Post by thatkeith » Wed Nov 05, 2014 10:17 pm

Interesting, that's a corner of the dictionary I haven't browsed through.
I'm not keen on this as a solution, however, as it's a 'word' that rather undermines what I'm going to be saying about the "plain Englishness" of the language. :D
Also because the dictionary says it's set to true by default, so it *should* be on already.

Thanks very much for the suggestion though, it's an interesting ability!
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: get URL odd behaviour

Post by bn » Wed Nov 05, 2014 10:49 pm

Hi Keith,

try

Code: Select all

 get URL "http://en.wikipedia.org/wiki/Special:Random"
it is without "https", at least it returns some html. And the result is empty. I did not look further into this.

Kind regards
Bernd

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm

Re: get URL odd behaviour

Post by zaxos » Wed Nov 05, 2014 11:12 pm

hey there thatkeith,

Code: Select all

   put URL "https://en.wikipedia.org/wiki/Special:Random" into theText
   set the htmltext of fld 1 to theText
OR

Code: Select all

put URL "https://en.wikipedia.org/wiki/Special:Random" into fld 1
they both seem to be working as expected allways, i'm using livecode 6.7 btw.
Knowledge is meant to be shared.

Post Reply