Author Topic: curl https  (Read 19523 times)

Script_test

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

Support

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

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: curl https
« Reply #3 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.

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: curl https
« Reply #4 on: July 21, 2016, 03:38:54 am »
This works fine for me under Linux.

Import curl.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
 

Script_test

  • Guest
Re: curl https
« Reply #5 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.

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: curl https
« Reply #6 on: August 04, 2016, 06:51:55 pm »
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, 10: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: 1
    • View Profile
Re: curl https
« Reply #8 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.

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: curl https
« Reply #9 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.
« Last Edit: August 12, 2016, 07:40:57 am by support »

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: curl https
« Reply #10 on: August 12, 2016, 07: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, 07:07:06 am »
Yes!! It is working !. ;D
Thank you very much!

Support

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