Lasso Soft Inc. > Home

[ curltoken ]

Type

[curltoken] is a data type that holds information about a libcurl session.

  • Syntax
  • Traits
curltoken
Has traits:
Examples
  • Intermediate

To obtain the header recieved from a curl operation

Code

local(ctoken, err, data, headerBytes = bytes, bodyBytes = bytes, ready = false)

#ctoken = curl_easy_init
#err = curl_easy_setopt(#ctoken, curlopt_url, "http://www.lassosoft.com/")
while(!#ready) => {
     #data = curl_multi_perform(#ctoken)
     #data->second->isa(::bytes) ? #headerBytes->append(#data->second)
     #data->last->isa(::bytes) ? #bodyBytes->append(#data->last)
     #ready = !#data->first
     !#ready ? sleep(10)
}
//#headerBytes contains the http headers returned
//#bodyBytes contains the data returned from the request

#headerBytes     //shows the headerbytes

Result

HTTP/1.1 200 OK
Date: Sun, 13 Feb 2011 12:01:08 GMT
Server: Apache/2.0.63 (CentOS)
MIME-Version: 1.0
Content-Length: 12220
Connection: close
Content-Type: text/html; charset=utf-8

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