ScriptBasic

Support => General Discussions => Topic started by: Script_test on July 19, 2016, 10:58:34 am

Title: curl https
Post by: Script_test on July 19, 2016, 10:58:34 am
Could you help me with an scriptbasic example of downloading content or access to a web site, using curl and https. (https://google.com).

ty.
Title: Re: curl https
Post by: Support on July 19, 2016, 08:27:05 pm
Welcome to the forum!

Here is the link to the Script BASIC cURL (http://www.scriptbasic.org/docs/curl/mod_curl_toc.html) extension module documentation.

I will try to post an example for you when I get a moment.
Title: Re: curl https
Post by: Script_test on July 20, 2016, 10:49:09 am
Code: [Select]
Import "c:\scriptbasic\include\curl.bas"
Import "c:\scriptbasic\include\cio.bas"
on error goto CURL_ERROR_CURL

CURL = curl::init()
curl::Option CURL,"CONNECTTIMEOUT",110
curl::option CURL,"FRESH_CONNECT"
curl::option Curl,"BUFFER_SIZE",1024
curl::option CURL,"MAXREDIRS",7

curl::option CURL,"REFERER","https://www.google.com"

curl::option CURL,"USERAGENT","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"

curl::option CURL,"COOKIEFILE","cookies.txt"

curl::option CURL,"URL","https://www.google.com"

curl::option CURL,"FILE","file.txt"

curl::perform CURL

curl::finish CURL
stop


rem ====================

CURL_ERROR_CURL:
PRINT "Some error happened while trying to download ScriptBasic home page. The error message is:\n"
PRINT curl::error()


STOP


curl::option CURL,"URL","https://www.google.com"


without the https protocol works correctly but fails https (error code: (0): error &H72: Built in function has too few arguments)

could you help me please,ty
Title: Re: curl https
Post by: Support on July 20, 2016, 11:27:01 pm
https: support is a libcurl related option. You may want to try a search for libcurll and https usage.

I'm trying to free up some time to have a closer look at this for you.
Title: Re: curl https
Post by: Support on July 21, 2016, 03:38:54 am
This works fine for me under Linux.

Code: Script BASIC
  1. Import curl.bas
  2.  
  3. on error goto CURL_ERROR_CURL
  4.  
  5. CURL = curl::init()
  6.  
  7. curl::Option CURL,"CONNECTTIMEOUT",110
  8. curl::option CURL,"FRESH_CONNECT"
  9. curl::option CURL,"BUFFER_SIZE",1024
  10. curl::option CURL,"MAXREDIRS",7
  11. curl::option CURL,"REFERER","https://www.google.com"
  12. curl::option CURL,"USERAGENT","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"
  13. curl::option CURL,"COOKIEFILE","cookies.txt"
  14. curl::option CURL,"URL","https://www.google.com"
  15. curl::option CURL,"FILE","file.txt"
  16.  
  17. curl::perform CURL
  18. curl::finish CURL
  19.  
  20. stop
  21.  
  22.  
  23. rem ====================
  24.  
  25. CURL_ERROR_CURL:
  26. PRINT "Some error happened while trying to download ScriptBasic home page. The error message is:\n"
  27. PRINT curl::error()
  28.  
  29. STOP
  30.  
Title: Re: curl https
Post by: Script_test on August 04, 2016, 04:41:33 pm
This script will fail on a machine running Windows .
Any idea how to fix it.
Thank you.
Title: Re: curl https
Post by: Support on August 04, 2016, 06:51:55 pm
I'll give is a try on Windows 7 and let you know what I find.

Title: Re: curl https
Post by: Script_test on August 11, 2016, 10:47:27 am
https: in windows XP - Fail
https: in windows 7 - Fail
https: in windows 10 - Fail
Can somebody help me?¿
Title: Re: curl https
Post by: Support on August 11, 2016, 06:58:18 pm
Quote
Can somebody help me?

I gave it a try on Windows 7 and it said my libcurl.dll wasn't found.  I have upgraded my laptop and still migrating my development environment to it. (Linux 64 & Win7 32 bit in a VirtualBox)

I will try to have another look at it today. Unfortunately I'm overwhelmed with real life issues at the moment and can't spend the time I would like with my free time open source efforts. I will do my best to help get us beyond this Windows/ cURL issue.
Title: Re: curl https
Post by: Support on August 12, 2016, 06:38:06 am
I found a set of Windows 32 bit libcurl DLLs and was able to run your example with an extension error using a https based site. I really think this is a Window cURL SSL issue and not a fault with the Script BASIC extension. I'm not sure yet what the error code being returned actually is.

(0): error 0x0008113c:Extension specific error: %s

My guess at this point is the SSL version of the libcurl.dll requires other DLLs to work with HTTPS / SSL sites. These seemed to be included with the Linux version of the library.
Title: Re: curl https
Post by: Support on August 12, 2016, 07:22:09 pm
This LIBCURL.DLL seems to work fine under Windows 7 32 bit.
Title: Re: curl https
Post by: Script_test on August 16, 2016, 07:07:06 am
Yes!! It is working !. ;D
Thank you very much!
Title: Re: curl https
Post by: Support on August 16, 2016, 08:31:04 am
Glad I can help and I hope you enjoy Script BASIC.