Topic: APLX Help : System Classes : Methods : Get
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

The 'Get' method


Argument: Character Vector
Result: 3-element Nested Vector

Valid for: HTTPClient

The Get method retrieves a page or other file from a web-server. The argument is a character vector which is the URL to retrieve (e.g. 'http://www.microapl.co.uk/apl/index.html').

The result is a three element vector.

The first element is the HTTP return code, which is an integer scalar. A number in the range 200 to 299 indicates success. A number in the range 400 to 499 indicates an error, such as 404 meaning 'page not found'. (See the documentation on the HTTPClient object for a list of codes)

The second element is a character vector indicating the MIME type of the returned data, such as 'text/plain'.

The third element is a character vector containing the data - this will usually be the HTML text of the web page (possibly with embedded carriage returns). If the MIME type begins with 'text', the data will have been translated to the APLX character set.

For example:

      H←'⎕' ⎕NEW 'HTTPClient'
      R←H.Get 'http://www.microapl.co.uk/apl/index.html'
      1⊃R
200
      2⊃R
text/html
      3⊃R
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- $$PAGE_TITLE$$='APLX<sup><small>TM</small></sup> The exciting  cross-platform APL' -->
<!-- $$SITE_ROOT$$='..' -->

<HTML>
<HEAD>
   <TITLE>APLX: The exciting cross-platform APL</TITLE>
... etc

Topic: APLX Help : System Classes : Methods : Get
[ Previous | Next | Contents | Index | APL Home ]