PHP CURL saves cookie into cookiejar but doesn't use it

后端 未结 1 1705
梦毁少年i
梦毁少年i 2021-01-14 13:44

I have a PHP script which uses CURL to log into a site with a simple login page. It sends an initial request to the site and sees if it\'s already logged in (due to cookies)

1条回答
  •  不要未来只要你来
    2021-01-14 14:20

    The first you must make sure __DIR__ have write permission.

    The second when you run code. You can check cookie.txt file had been create or not.

    The third you must use ONE cookie for all session. So the victim know you logged in.

    And try my source

    $cookies = tempnam('/tmp','cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); 
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
    

    0 讨论(0)
提交回复
热议问题