Support => ScriptBasic Examples w/source => Topic started by: Support on May 17, 2006, 11:14:30 pm

Title: WEBGET - Browser based Curl Example
Post by: Support on May 17, 2006, 11:14:30 pm
This example Curl program will retrieve the source HTML of the URL you submit. IE doesn't work with default security settings and the 'MIME Sniffing" feature needs to be disabled so the file attribute is used for MIME determination like the other browsers. MSDN Reference (

Code: [Select]

*** getweb.bas ***

#!/usr/bin/scriba -c

INCLUDE cgi.bas
INCLUDE curl.bas

OPTION cgi$Method cgi::Post or cgi::Get

this_url = cgi::PostParam("geturl")

CURL = curl::init()
curl::option CURL,"URL",this_url
curl::option CURL,"FILE","/var/www/vhosts/"
curl::perform CURL
curl::finish CURL

cgi::Header 302,""
PRINT "Location: /pagedump.txt\n"


*** curl.html ***

<title>ScriptBasic WebGet</title>
<h1>Curl Example</h1>

Enter URL to retrieve:

<form method="post" action="/cgi-bin/getweb.bas">
  <input type="text" name="geturl" size=40>
  <input type="submit" value="Get Page">