request_string, request_tuple

Format: request_string ( url, options )
Format: request_tuple ( url, options )

Purpose: Both functions provide access to the curl library (http://curl.haxx.se/) for retriving docments from the web using http and ftp requests. Both functions perform the same operation but request_tuple returns additional information.

Both functions are available only if secure mode is off and if the requestcurl module has been compiled or linked into heitml.

Return Values: When successful, request_string() returns a string containing the document obtained. request_string() in turn returns a tuple with various fields containing information about the request performed. The field "..." contains the document obtained,

Options Argument:

Both functions have an additional argument options. It must be a tuple containing various options for curl. The following options are supported and are documented in the curl web site or the curl manual page ("man curl_easy_setopt"): Proxy, ProxyPort, httpproxytunnel, ProxyType, Interface, LocalPort, LocalPortRange, dns_cache_timeout, dns_use_global_cache, buffersize, port, tcp_nodelay, netrc, netrc_file, userpwd, proxyuserpwd, httpauth, proxyauth, AutoReferer, Encoding, FollowLocation, unrestricted_auth, maxredirs, put, post, postfields, postfieldsize, httppost (post data as tuple), Referer, UserAgent, header (headers as tuple), cookie, cookieSession, cookielist, get, http_version, ignore_content_length, ftpport, FtpListOnly, FtpAppend, ftp_use_eprt, ftp_use_epsv, ftp_create_missing_firs, ftp_response_timeout, ftp_alternative_to_user, ftp_skip_pasv_ip, ftp_ssl, ftp_sslauth, source_url, source_userpwd, ftp_account, ftp_filemethod, TransferText, crlf, range, resume_from, customRequest, filetime, nobody, inFileSize, upload, maxFileSize, timecondition, timevalue, timeout, low_speed_limit, low_speed_time, maxConnects, closepolicy, fresh_connect, forbid_reuse, connectTimeOut, ipresolve, sslCert, sslCertType, sslCertPasswd, sslKey, sslKeyType, sslKeyPasswd, sslKeyType, sslKeyPasswd, sslEngine, sslEngine_default, sslversion, ssl_verifyPeer, caInfo, caPath, random_file, egdSocket, verifyHost, ssl_cipher_list.

Example:

input:
<let 
    s= request_string ("http://www.radpage.com/"); 
    // s now contains the complete homepage of radpage.com

    // extract the title using a regular expression and print it 
    ? substRE (s,"(?is:^.*TITLE>(.*)</TITLE.*$)","$1") "H";
>
resulting output:
  Component based Web Development Tool - RADpage 

Example:

input:
<let 
    t= request_tuple ("http://www.h-e-i.de/"); 
    ? t;
>
resulting output:
content="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML "..."nload(){fixPng()} //--> </script></BODY>"
response_code=200
http_connectcode=0
effective_url="http://www.h-e-i.de/"
filetime=-1
total_time=0.138544
namelookup_time=0.001556
connect_time=0.025200
pretransfer_time=0.025204
starttransfer_time=0.052997
redirect_time=0.000000
redirect_count=0
size_upload=0.000000
size_download=42430.000000
speed_download=306256.000000
speed_upload=0.000000
header_size=187
request_size=51
ssl_verifyresult=0
content_length_download=0.000000
content_length_upload=0.000000
content_type="text/html"
os_errno=0
num_connects=1

Example:

input:
<let 
    opts=emptytuple; opts.followlocation=false; // prevent following redirects
    t= request_tuple ("http://www.radpage.com/heitml2.1", opts); 
    ? t;
    ? t.content "H";
>
resulting output:
content="<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML"..."ge.com Port 80</ADDRESS> </BODY></HTML> "
response_code=301
http_connectcode=0
effective_url="http://www.radpage.com/heitml2.1"
filetime=-1
total_time=0.052499
namelookup_time=0.001381
connect_time=0.026169
pretransfer_time=0.026174
starttransfer_time=0.052464
redirect_time=0.000000
redirect_count=0
size_upload=0.000000
size_download=322.000000
speed_download=6133.000000
speed_upload=0.000000
header_size=224
request_size=63
ssl_verifyresult=0
content_length_download=0.000000
content_length_upload=0.000000
content_type="text/html; charset=iso-8859-1"
os_errno=0
num_connects=1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>301 Moved Permanently</TITLE> </HEAD><BODY> <H1>Moved Permanently</H1> The document has moved <A HREF="http://www.radpage.com/heitml2.1/">here</A>.<P> <HR> <ADDRESS>Apache/1.3.34 Ben-SSL/1.55 Server at www.radpage.com Port 80</ADDRESS> </BODY></HTML>


This page was dynamically generated by the web application development tool RADpage of H.E.I.
© 1996-2017 H.E.I. All Rights Reserved.



Homepage
Intro/Features
Component Guide
Programming
  Language Guide
  Language Ref.
    General Design
    Lexical Structure
    Expressions
    Objects
    Methods
    Classes
    heitml Tags
    heitml Functions
    Advanced Functions
      containsRE
      containsCaseRE
      createMatchArray
      fileio_chmod
      fileio_fclose
      fileio_feof
      fileio_fopen
      fileio_fread
      fileio_fwrite
      fileio_strerror
      indexRE
      indexCaseRE
      regexcomp
      regexexec
      request_string
      request_tuple
      substr
      substRE
      substallRE
      TuSearch
      TuSearchTuple
      TuSort
    Database Access
    Global Variables
    Form Fields
    Server Variables
    Sessions
    heitml Syntax
  Component Ref.
  Class Library
  User Components
  Tryout Form
  Tutorial
  New Features
  heitml 1
User Guide
FAQ
Mailinglist
Discussion Group
Services
Pricing/Register
Download
Frame
 
Contact
 
 
 
Search: