Yes. examples\System\Internet\VerySimpleBrowser.o2bas
Also supports ftp.
It stores the result in t.txt
extern lib "wininet.dll"
! InternetOpenA
! InternetOpenUrlA
! InternetCloseHandle
! InternetReadFile
string buf=nuls 0x20000 '128k
string tbuf
string url="https://www.oxygenbasic.org/index.html"
int cbytes
sys hInternet
sys hFile
int c
hInternet = InternetOpenA( "o2demo",0,0,0,0 )
hFile = InternetOpenUrlA( hInternet,url,0,0,0,0 )
do
cbytes=0
InternetReadFile( hFile,buf,len(buf),@cbytes )
if cbytes
tbuf+=left(buf,cbytes)
c++
else
exit do
endif
loop
InternetCloseHandle( hFile )
InternetCloseHandle( hInternet )
'print tbuf
putfile( "t.txt",tbuf )
'print c 'count loops
NOTES:
======
'https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetopena
'https://docs.microsoft.com/en-us/cpp/mfc/wininet-basics?view=vs-2019#_core_create_a_very_simple_browser
/*
% INTERNET_OPEN_TYPE_DIRECT 1
% INTERNET_FLAG_ASYNC 0x10000000
*/
/*
extern lib "wininet.dll"
sys InternetOpenA(
LPCSTR lpszAgent,
DWORD dwAccessType,
LPCSTR lpszProxy,
LPCSTR lpszProxyBypass,
DWORD dwFlags
);
BOOLAPI InternetCloseHandle(
HINTERNET hInternet
);
BOOLAPI InternetCanonicalizeUrlA(
LPCSTR lpszUrl,
LPSTR lpszBuffer,
LPDWORD lpdwBufferLength,
DWORD dwFlags
);
sys InternetOpenUrlA(
HINTERNET hInternet,
LPCSTR lpszUrl,
LPCSTR lpszHeaders,
DWORD dwHeadersLength,
DWORD dwFlags,
DWORD_PTR dwContext
);
BOOLAPI InternetReadFile(
HINTERNET hFile,
LPVOID lpBuffer,
DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead
);
BOOLAPI InternetFindNextFileA(
HINTERNET hFind,
LPVOID lpvFindData
);
*/
'#include <afxinet.h>
/*
void DisplayPage(LPCTSTR pszURL)
{
CInternetSession session(_T("My Session"));
CStdioFile* pFile = NULL;
CHAR szBuff[1024];
//use a URL and print a Web page to the console
pFile = session.OpenURL(pszURL);
while (pFile->Read(szBuff, 1024) > 0)
{
printf_s("%1023s", szBuff);
}
delete pFile;
session.Close();
}
*/