Author Topic: cURL Example  (Read 16304 times)

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
cURL Example
« on: July 10, 2010, 10:41:36 PM »
The following cURL extension module example retrieves a web page HTML and saves it to your PC. (webget)

Code: [Select]
' cURL webget

INCLUDE curl.bas

ch = curl::init()
curl::option(ch,"URL","http://scriptbasic.com/html/general.html")
curl::option(ch,"FILE","general.html")
curl::perform(ch)
curl::finish(ch)

cURL extension module documentation


Here is a webget by opening a TCP socket using ScriptBasic.

Code: [Select]
OPEN "scriptbasic.com/html/general.html:80" for SOCKET AS #1
PRINT #1,"GET http://localhost/ HTTP/1.0\n\n"
WHILE NOT EOF(1)
  LINE INPUT #1, content
  PRINT content
WEND
CLOSE(1)
« Last Edit: July 11, 2010, 12:58:41 PM by support »