2

I'm trying to run a script that uses PHP CURL to log in into a website, and I want to save that cookie to use in further requests.

My curl connection have this configuration:

CURLOPT_FOLLOWLOCATION => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)",
CURLOPT_COOKIEJAR => dirname(__FILE__) . "/cookie.txt",
CURLOPT_COOKIEFILE => dirname(__FILE__) . "/cookie.txt"

The problem is that I wrote this code using Wamp on Windows, and works great! The login succeeds and the cookie.txt is created.

But when I use the same code using XAMPP on Linux, it doesn't work. The cookie.txt is not created, and I can't do the further requests without the cookie file. This code also works online when I upload it to the server.

No erros are reported by CURL when I open the PHP page, but the login fails and the file is not created. I even setted the permission 777 to lampp's folder and subfolders, I know that isn't a good idea, but still not working. Can anyone help with it?

I'm using Ubuntu 16.04 LTS and XAMPP 7.2.5-0

0

You must log in to answer this question.

Browse other questions tagged .