Code: Select all | Expand
#include "hbcurl.ch"
function Main()
? urlLoad( "https://raw.githubusercontent.com/FiveTechSoft/harbourPackages/main/python/init.prg" )
return nil
function urlLoad( cUrl )
local hCurl, nRet
if ! Empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYHOST, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_FOLLOWLOCATION )
curl_easy_setopt( hCurl, HB_CURLOPT_FILETIME, 1 )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_FILE_SETUP, SubStr( cUrl, RAt( "/", cUrl ) + 1 ) )
curl_easy_setopt( hCurl, HB_CURLOPT_NOPROGRESS, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_FAILONERROR , .T. )
nRet = curl_easy_perform( hCurl )
curl_easy_cleanup( hCurl )
endif
return nRet