The loadurl( function loads a resource from the internet.


This function has three parameters:

url – The address of the resource to be loaded, for example "http://www.apple.com".

timeout – The maximum number of seconds to wait for a response from the server. This parameter is optional. If omitted, the default timeout is 60 seconds.

cachepolicy – The cache policy to use for loading this resource. This parameter is optional. If omitted, the default cache policy will be used (0). If you want to ignore the cache and always go to the server, set the cache policy to 1. If you want to get hardcore and find out about other options, google NSURLRequestCachePolicy. For almost all operations, the default policy is the way to go.


This function loads a resource from the internet, for example a web page or an image. For example, this procedure will display the home page of the Apple web site.

displaydata loadurl("http://www.apple.com")

Note that when we say “display”, we actually mean it displays the HTML source of the page, not what you would see in a web browser. (Of course you can use Panorama’s Web Browser object to actually display a web page in a form.

Unlike in Panorama 6.0 and earlier, the loadurl( function doesn’t always return text – it can also return binary data. This can be handy if you are downloading a non-text resource, for example an image. However, in some cases loadurl( will return binary data when you expect text – it depends on the attributes returned by the web server. For example, loading a page from apple.com or google.com results in text, but loading a page from provue.com or nshipster.com returns binary data (at the time this was written). If you know that the data is text, you can just use it as text and it will be converted automatically, or you can use the binarytotext( function to do so explicitly.

displaydata binarytotext(loadurl("http://www.provue.com"))

Note: The loadurl( function uses HTTP GET to retrieve the resource. If you want to use HTTP PUT, use the posturl(, url( or urltask( function.

Note: The loadurl( function is synchronous. This means that Panorama stops in its tracks until the communication is complete, so you should avoid this function if possible and use urltask( instead.

See Also


10.0UpdatedCarried over from Panorama 6.0, but now can return binary data as well as text, and has optional parameters for controlling the timeout and cache policy.