Page 1 of 1

get URL odd behaviour

Posted: Wed Nov 05, 2014 6:52 pm
by thatkeith
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

Re: get URL odd behaviour

Posted: Wed Nov 05, 2014 7:17 pm
by thatkeith
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

Re: get URL odd behaviour

Posted: Wed Nov 05, 2014 8:55 pm
by jacque
You could try setting the libUrlFollowHttpRedirects to true (see dicionary.) Worth a shot.

Re: get URL odd behaviour

Posted: Wed Nov 05, 2014 10:17 pm
by thatkeith
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!

Re: get URL odd behaviour

Posted: Wed Nov 05, 2014 10:49 pm
by bn
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

Re: get URL odd behaviour

Posted: Wed Nov 05, 2014 11:12 pm
by zaxos
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.