Difference between revisions of "GETURL()"

From Lianjapedia
Jump to: navigation, search
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
Function to return a URL as text
+
Function to talk with HTTP web servers and consume data provided by web services
  
 
==Syntax==
 
==Syntax==
GETURL(<expC1> [, <expN> [, <expO> [, expC2>]]])
+
GETURL(<expC1> [, <expN> [, <expO> &#124; <dynamic-array> [, expC2>]]])
  
 
==See Also==
 
==See Also==
Line 10: Line 10:
 
==Description==
 
==Description==
 
The GETURL() function reads the specified URL, <expC1>, and returns its contents as text.  The optional <expN> parameter allows a timeout in seconds to be set.
 
The GETURL() function reads the specified URL, <expC1>, and returns its contents as text.  The optional <expN> parameter allows a timeout in seconds to be set.
 +
 +
{| class="wikitable" width = 100%
 +
!Parameter||Description||Example
 +
|-
 +
|<expC1>||Fully qualified URI||http://search.twitter.com/search.json?q=twitterapi&rpp=1
 +
|-
 +
|valign=top|<expN>||The timeout in seconds for the request (default 30). Set this to 0 for no timeout.||valign=top|30
 +
|-
 +
|valign=top|<expO> &#124; <dynamic-array>||valign=top|An object or dynamic array containing the HTTP header elements
 +
|headers = array()
 +
headers[] = "Host: search.twitter.com"
 +
headers[] = "Authentication: Basic " + base64_encode("username:password")
 +
|-
 +
|<expC2>||Name of file in which to store data||"myfilename.json"
 +
|-
 +
|}
  
 
==Example==
 
==Example==

Revision as of 08:12, 9 January 2013

Purpose

Function to talk with HTTP web servers and consume data provided by web services

Syntax

GETURL(<expC1> [, <expN> [, <expO> | <dynamic-array> [, expC2>]]])

See Also

AT(), ATNEXT(), FCLOSE(), FCREATE(), FERROR(), FGETS(), FILETOSTR(), FOPEN(), FPUTS(), FREAD(), FREADSTR(), FWRITE(), ISSERVER(), JSON_DECODE_FILE(), POSTURL(), SUBSTR(), STUFF(), STR(), STREXTRACT(), STRTOFILE(), STRTRAN(), STRZERO(), TRIM(), XML_DECODE_FILE()

Description

The GETURL() function reads the specified URL, <expC1>, and returns its contents as text. The optional <expN> parameter allows a timeout in seconds to be set.

Parameter Description Example
<expC1> Fully qualified URI http://search.twitter.com/search.json?q=twitterapi&rpp=1
<expN> The timeout in seconds for the request (default 30). Set this to 0 for no timeout. 30
<expO> | <dynamic-array> An object or dynamic array containing the HTTP header elements headers = array()

headers[] = "Host: search.twitter.com" headers[] = "Authentication: Basic " + base64_encode("username:password")

<expC2> Name of file in which to store data "myfilename.json"

Example

<!-- twitter.rsp -->
<html>
<body>
<%
? geturl("http://twitter.com/recitalsoftware",60)
%>
</body>
</html>