ScriptBasic

ScriptBasic => Tutorials => Topic started by: Support on September 24, 2008, 05:50:34 PM

Title: Retriving a web page
Post by: Support on September 24, 2008, 05:50:34 PM
Q. How would I go about getting the html from a web page on the net?

A. You have two options. You can use the built in socket support in ScriptBasic or use the cURL extension module.

ScriptBasic Native
Code: [Select]
ON ERROR GOTO SiteError
OPEN "allbasic.info:80" FOR SOCKET AS #1
PRINT #1,"GET http://localhost/ HTTP/1.0\n\n"

WHILE NOT EOF(1)
  LINE INPUT #1, page_line
  PRINT page_line
WEND
CLOSE #1
END

SiteError:
PRINT "The web server allbasic.info on port 80 is not available\n"

cURL Extension Module

Example on All Basic (http://www.allbasic.info/forum/index.php?topic=49.0)