ScriptBasic
May 22, 2012, 01:53:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The ScriptBasic User, Developer and extension module guides are available at the WIKI.
 
   Home   Wiki Help Search Login Register  
Pages: [1]
  Print  
Author Topic: cURL Example  (Read 1427 times)
support
Administrator
*****
Posts: 409


« 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:
' 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:
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 » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!