Page 1 of 1

get url(any/success?someone)

Posted: Thu Sep 24, 2015 9:00 am
by hliljegren
Have anyone succeeded to use get URL?

If I put my LiveCode project files on a server at
http://www.example.com/test/

and then try to get a file via:

Code: Select all

get url "http://www.example.com/test/text.txt"
I get an assertion failure. Anyone having tried the get url command with a successful result?

Re: get url(any/success?someone)

Posted: Thu Sep 24, 2015 9:05 am
by peter-b
Unfortunately we have a known issue with most commands that need to wait for something to happen, because JavaScript makes it very difficult.

You should be able to do:

Code: Select all

put URL "<url>" into tVariable
But that's the only URL syntax that's expected to work at the moment. Sorry! We plan to address this soon (but it turns out be rather tricky to do without making the whole engine really really slow).

Re: get url(any/success?someone)

Posted: Thu Sep 24, 2015 4:05 pm
by hliljegren
Thanks! I'm sure that I tried that first but tried again now and it somewhat works.

I have a card with two fields: URL, Result and a button with the following code:

Code: Select all

on mouseUp
   put field "URL" into tURL
   put url tURL into tData
   if the result is empty then
      put tData into field "Result"
   else
      put the result into field "Result"
   end if
end mouseUp
My minimal test.php looks like:

Code: Select all

<?php

 echo "Hello ". $_GET["name"] . "!";

?>
If I go to my_server.com/some/folder/index.html it always work, but, if I go to a php file in the same folder: my_server.com/some/folder/test.php?name=world it fails around 50% of the times. the result is then Request failed. So it goes kind of like this (for test.php):

Click : Request failed
Click : Request failed
Click : Hello world
Click : Hello world
Click : Hello world
Click : Request failed
Click : Hello world
...

Re: get url(any/success?someone)

Posted: Thu Sep 24, 2015 4:09 pm
by hliljegren
Looking at the JavaScript console I see that every time when the request fails I see that I get :
Failed to load resource: The request timed out.
I have similar experience across supported browsers.

Re: get url(any/success?someone)

Posted: Mon Sep 28, 2015 9:48 am
by peter-b
You can change the timeout used by HTTP requests by setting

Code: Select all

the socketTimeOutInterval
: https://livecode.com/resources/api/#liv ... utinterval

Re: get url(any/success?someone)

Posted: Tue Oct 20, 2015 8:45 am
by Kangaroo SW
@ hliljegren

Can you/someone which has successfully been able to load a text file into a stack, please send an example stack here
which works ?!

I tried all combinations I can think of and also the trick wich puts an URL into a variable first, and then display it ...

Nothing worked so far :-(

Re: get url(any/success?someone)

Posted: Tue Feb 16, 2016 4:00 pm
by MadManSoft
I have been unable to get this working in DP14, using get URL or put URL.

It will lock the browser :(

Re: get url(any/success?someone)

Posted: Tue Feb 16, 2016 5:06 pm
by FourthWorld
hliljegren wrote:Looking at the JavaScript console I see that every time when the request fails I see that I get :
Failed to load resource: The request timed out.
I have similar experience across supported browsers.
If you're getting frequent timeouts the best you can do is to report the timeout error as suggested, but that won't fix the actual problem.

The server has an issue. You'll need to find it out it can't deliver the requested file in a timely manner.

Re: get url(any/success?someone)

Posted: Tue Feb 16, 2016 7:15 pm
by [-hh]
URL-methods with extern sources do currently NOT (yet) work in HTML5 standalones.

These methods would require the wait-syntax which causes an overall slowdown by a factor > 200.
That's why it has been disabled again in 8.0.0-dp14.

The above is my short summary from several posts and notices of Peter here and in the use-list.
Please correct me if I'm wrong.