Page 1 of 2
Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Wed Nov 19, 2014 3:53 pm
by luisvaa
Hi everybody!
I'm having trouble using get (or load) to load a URL and put the results in a container.
Using this code:
Code: Select all
on mouseUp
put the text of field "miURL" Into theURL
get URL (theURL)
put it into theWebPageContent
put the result into theError
if theError is empty then
set the text of field "Contenido" to theWebPageContent
else
set the text of field "Contenido" to "An error occurred:" && theError & "."
end if
end mouseUp
I get into the field the following message: --> An error occurred: invalid host address.
the URL is correctly spelled starting with http using google website
Currently I'm developing using Windows 7.
So far, I have tried the following:
Enabled LiveCode Community 7.0 in Windows firewall.
Disabled Windows Firewall
Disabled AV software
Checked host file
Checked "Internet" is included for a standalone app
Lots of web search...
But, if I use the following code:
Code: Select all
on mouseUp
put the text of field "miURL" Into theURL
put hostNameToAddress(theURL) into field "Contenido"
end mouseUp
With the URL without http
the result is all googles ip addresses without error...
What am I doing wrong? the same problems occur if I use LOAD or PUT instead of GET.
Any help is appreciated!!
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 7:51 am
by Simon
Hi luisvaa,
Welcome to the forum
I'm not seeing a problem with your code, it's working here.
What is the actual url you are using?
Simon
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 3:28 pm
by luisvaa
Hi Simon,
Thanks!!!
The forum don't let me put the whole URL because of permission
I'm using googles site, starting from http all the way to [dot]com
and for the second part starting from www to [dot]com
without double quotes or anything else.
I'm thinking is more of a system issue than code issue since I pretty much just copied a tutorial.... unless there are http headers that I'm missing or some other config I haven't tried.
Also I've reinstalled Livecode, checked for updates, and tried installation for: "All users" and "Just me"
I don't have a Mac so I can't test there.
It's driving me crazy not been able to do something so simple.
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 4:14 pm
by FourthWorld
"Invalid host address" suggests the contents of field "URL" may not be a valid URL. Does the field contain any leading or trailing spaces, or carriage returns?
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 4:54 pm
by luisvaa
Hi FourthWorld,
Not that I'm aware, using the code:
Code: Select all
on mouseUp
put "http with google url [dot] com" into theURL
get URL (theURL)
put it into theWebPageContent
put the result into theError
if theError is empty then
set the text of field "Contenido" to theWebPageContent
else
set the text of field "Contenido" to "An error occurred:" && theError & "."
end if
end mouseUp
End up having the same error
Again, I can't put the exact url as in the code due to forum permissions
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 5:03 pm
by luisvaa
This is a screen capture of the code with the url.

- with the url
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 5:48 pm
by luisvaa
Also tried running as Administrator and with compatibility mode for winXP and Vista.... nothing works

Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 6:08 pm
by newtronsols
I notice you don't declare t... variables as local or global maybe LC 7 & windows is fussy about local variables being declared.
see variable checking:
http://livecode.com/blog/2014/03/12/10- ... ell-maybe/
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 6:19 pm
by luisvaa
Hi newtronsols,
updated code:
Code: Select all
on mouseUp
local theURL
local theWebPageContent
local theError
put the text of field "miURL" into theURL
get URL (theURL)
put it into theWebPageContent
put the result into theError
if theError is empty then
set the text of field "Contenido" to theWebPageContent
else
set the text of field "Contenido" to "An error occurred:" && theError & "."
end if
end mouseUp
Still nothing.... step by step execution shows the URL correctly been put into miURL variable, with or without local variable declaration.
After the execution of GET the it variable is empty... that helps?
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 7:57 pm
by SparkOut
All I can suggest is that if the url has been checked correctly (and I believe you, seeing that you typed it directly in the script shown in your screenshot) you might look at the proxy settings on your computer and see if that has a bearing. Does the same stack have the same problem on another PC in a different networked environment?
Apart from that I could wonder if you change the get url ... and put it into ... statements into
Code: Select all
put url (theUrl) into theWebPageContent
and then just
to see if the messagebox contains something readable. If it does, then you would need to check the properties of the field "Contenido". (There's nothing wrong with the way you get the url and then put it into the destination variable, but I'm just wondering about the volatility of the it variable - although it would be alarming if this made a real difference, even stepping through the code it shouldn't change by the very next statement).
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Thu Nov 20, 2014 9:27 pm
by FourthWorld
I don't have my Win7 machine with me at the moment, but in Win8.1 using LC Community 7.0 "Stable" I ran this in the Message Box and it worked fine:
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Fri Nov 21, 2014 11:41 am
by bangkok
Code: Select all
on mouseUp
local theURL
local theWebPageContent
local theError
put the text of field "miURL" into theURL
get URL (theURL)
put it into theWebPageContent
put the result into theError
if theError is empty then
set the text of field "Contenido" to theWebPageContent
else
set the text of field "Contenido" to "An error occurred:" && theError & "."
end if
end mouseUp
This code works perfectly on Windows 7 with LC version 5.5, version 6.5 and 7 and with "
http://www.google.com" in the "miURL" field.
And when I remove my Ethernet plug... I got the error message "An error occurred: invalid host address."
Ergo : you have a serious problem of network/Internet access.

Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Fri Nov 21, 2014 3:50 pm
by luisvaa
Hi fourthWorld,
Nothing, just the put returns empty. I don't have a proxy, and also the function hostNameToAddress(theURL) works just fine returning the IP's, so I don't think it's a dns problem.
Bangkok, let me see what can I find, since I'm writing to the forum from the same computer.... maybe it's a wifi issue, I'll try using ethernet instead
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Fri Nov 21, 2014 5:04 pm
by luisvaa
Nothing, using ethernet instead of wifi does not work.
Re: Problem using GET, LOAD and PUT with URL in Windows 7
Posted: Fri Nov 21, 2014 5:24 pm
by FourthWorld
The way to solve any problem is to identy the differences between the working and non-working states.
Assuming the URL works in the browser, we need to determine how the browser connection differs from LiveCode's.
LC isn't going anything all that unusual - it just opens a socket to the requested URL and submits requests per the HTTP RFC.
But what LC doesn't do is some of the less common settings for proxies or other network-specific settings that many browsers support.
Based on the assumption that the URL works in the browser, and that you've thoroughly checked that no non-visible characters like spaces, CRs, or NULLs are in the LC version of that URL, what are your browser's proxy settings? What sort of network are you running on? Is the problem consistently present when attempted through another network (that is, if this is failing at work does it also fail at home or at your local cafe)?