Lasso Soft Inc. > Home

[ include_url ]

Method

[Include_URL] includes a Web page, image, or other resource from a remote HTTP or HTTPS server. The downloaded data can be displayed in the current format file, processed, or served.

The URL parameter is required. It should be a valid URL and may contain GET parameters. The remote page will be fetched and the response will be returned as the result of the tag.

All other parameters are optional and change the information that is sent to and received from the remote server.

-NoData sends the URL to the remote server, but ignores the reply. The method returns nothing.

-Username and -Password allow authentication information to be sent along with the URL. The authentication information will be sent to the remote server just as if they had been typed into the authentication dialog of a Web browser.

-GETParams and -POSTParams allow an array of name/value pairs to be passed along with the URL to the remote server. GET parameters are appended to the end of the URL itself. POST parameters are submitted as if they were form elements. -POSTParams can also be passed a string which will be sent as the body of the POST. This allows XML data to be posted to remote servers for SOAP communications.

-SendMIMEHeaders allows an array of extra HTTP request headers to be passed along with the URL to the remote server.

-RetrieveMIMEHeaders allows an array of MIME headers sent back from the remote server in the HTTP response to be inspected. The -RetrieveMIMEHeaders parameter requires the name of a variable in which the array of headers will be stored.

-VerifyPeer can be used to perform a more rigorous check of the peer's SSL certificate if the HTTP protocol is being used.

-SSLCert, SSLCertType, SSLKey, -SSLKeyType, -SSLKeyPasswd are parameters to pass for SSL options.

-Timeout and -ConnectTimeout govern the wait time behaviour for responses.

-Options is an array of parameter/value pairs to set specific options within the curl datatype that include_url leverages.

-String instructs include_url to force the return of the retrieved information to be cast as a string type.

  • Syntax
include_url(
	url, 
	-getparams 		= array('paramname'='paramvalue',...), 
	-postparams 	= array('paramname'='paramvalue',...), 
	-sendmimeheaders = array('Name'='Value'),
	-username 		= string, 
	-password 		= string, 
	-nodata 			= boolean, 
	-VERIFYPEER 		= boolean, 
	-SSLCERT 		= string, 
	-SSLCERTTYPE 	= string, 
	-SSLKEY 		= string, 
	-SSLKEYTYPE 	= string, 
	-SSLKEYPASSWD 	= string, 
	-TIMEOUT 		= integer, 
	-CONNECTTIMEOUT = integer, 
	-retrievemimeheaders = string, 
	-options 		= array, 
	-string 			= boolean
)

include_url('http://www.example.com')

include_url('http://www.example.com', -NoData = true)

include_url( 'http://www.example.com',  
  -POSTParams=array('Name'='Value')
)

include_url('http://www.example.com',  
  -POSTParams=' ... '
)

include_url('http://www.example.com',  
  -GETParams=array('Name'='Value')
)

include_url('https://www.example.com',  
  -Username='Username', 
  -Password='Password'
)

include_url('http://www.example.com',  
  -SendMIMEHeaders=array('Name'='Value')
)

include_url('http://www.example.com',  
  -RetrieveMIMEHeaders='Variable Name'
)
Examples
  • Beginner
  • Intermediate

To create a proxy for Web requests:

Pass an [Action_Param] to the [Include_URL] method and return the results of that method in place of the current file. The following example simply returns the URL specified in a URL parameter to the file.

Code

Include_URL(Action_Param('URL'))

To use the HTTP DELETE Method with JSON encoded data in communicating with an external AI, use the -options param for include_url with CURLOPT_CUSTOMREQUEST='DELETE'

Code

include_url($target_url,-POSTParams = '{"action":"Deleting record 1234","recordID":"1234"}, -options=array(CURLOPT_CUSTOMREQUEST='DELETE'), -sendmimeheaders = array('Content-Type'='application/json'), -string=true, -username='username',-password='******')

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft