Author Topic: curl https  (Read 25269 times)

Script_test

  • Guest
curl https
« on: July 19, 2016, 03: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.
« Last Edit: July 19, 2016, 05:06:13 AM by Script_test »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #1 on: July 19, 2016, 01:27:05 PM »
Welcome to the forum!

Here is the link to the Script BASIC cURL extension module documentation.

I will try to post an example for you when I get a moment.

Script_test

  • Guest
Re: curl https
« Reply #2 on: July 20, 2016, 03: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

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #3 on: July 20, 2016, 04: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.

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #4 on: July 20, 2016, 08:38:54 PM »
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.  

Script_test

  • Guest
Re: curl https
« Reply #5 on: August 04, 2016, 09:41:33 AM »
This script will fail on a machine running Windows .
Any idea how to fix it.
Thank you.

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #6 on: August 04, 2016, 11:51:55 AM »
I'll give is a try on Windows 7 and let you know what I find.


Script_test

  • Guest
Re: curl https
« Reply #7 on: August 11, 2016, 03:47:27 AM »
https: in windows XP - Fail
https: in windows 7 - Fail
https: in windows 10 - Fail
Can somebody help me?¿

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #8 on: August 11, 2016, 11:58:18 AM »
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.

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #9 on: August 11, 2016, 11:38:06 PM »
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.
« Last Edit: August 12, 2016, 12:40:57 AM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #10 on: August 12, 2016, 12:22:09 PM »
This LIBCURL.DLL seems to work fine under Windows 7 32 bit.

Script_test

  • Guest
Re: curl https
« Reply #11 on: August 16, 2016, 12:07:06 AM »
Yes!! It is working !. ;D
Thank you very much!

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: curl https
« Reply #12 on: August 16, 2016, 01:31:04 AM »
Glad I can help and I hope you enjoy Script BASIC.