Author Topic: curl::option CURL,"COOKIEFILE"  (Read 15900 times)

Script_test

  • Guest
curl::option CURL,"COOKIEFILE"
« on: August 28, 2016, 11:53:43 PM »
hello again, the option does not work under windows.
Code: [Select]
curl::option CURL,"COOKIEFILE","cookies.txt"

Any idea how to solve, an update?

thank you very much in advance.

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: curl::option CURL,"COOKIEFILE"
« Reply #1 on: August 29, 2016, 11:33:01 PM »
Did you try using a full path for cookies.txt?

Just a guess. I would look at the LibcURL docs and do a Google search for the option, specifying Windows.

Script_test

  • Guest
Re: curl::option CURL,"COOKIEFILE"
« Reply #2 on: August 30, 2016, 03:33:26 AM »
It doesn't matter the path. The problem is that not create the file. :-[

This small example, attempt to log into a local installation of wordpress. On my systen (windows) does not generate the file to store cookies.

Code: [Select]
Import "c:\scriptbasic\include\curl.bas"
Import "c:\scriptbasic\include\cio.bas"
rem Login & Pass
username = "admin"
password = "password"

rem web Site
url = "http://localhost/wordpress/"

rem Directory
directorio ="c:\\scriptbasic\\wordpress\\"

cookie = directorio & "\\cookie.txt"

rem Form Data

postdata = "log=" & $username & "&pwd=" & $password & "&wp-submit=Log%20In&redirect_to=" & url & "wp-admin/&testcookie=1"

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


curl::option CURL,"FOLLOWLOCATION"
curl::option CURL,"MAXREDIRS",7
curl::option CURL,"REFERER",url & "wp-login.php"
curl::option CURL,"USERAGENT","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"
curl::option CURL,"COOKIEFILE",cookie
curl::option CURL,"URL",url & "wp-login.php"
curl::option Curl,"POSTFIELDS",postdata
rem File
curl::option CURL,"FILE",directorio & "file.txt"
rem VERBOSE
curl::option Curl,"VERBOSE"

curl::perform CURL

curl::finish CURL
rem



Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: curl::option CURL,"COOKIEFILE"
« Reply #3 on: August 30, 2016, 10:22:27 AM »
Windows doesn't like files being created in the root directory.

Can you try running your script in a console that has administrative privileges? This will tell you if it's a permission problem or not.


Script_test

  • Guest
Re: curl::option CURL,"COOKIEFILE"
« Reply #4 on: August 30, 2016, 11:53:54 PM »

Yes, is running under administrator privileges.

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: curl::option CURL,"COOKIEFILE"
« Reply #5 on: August 31, 2016, 09:43:12 AM »
Glad you got that worked out.

Windows security is a joke!